Clarify that version-sorting looks for the *longest* sequence of digits
This commit is contained in:
parent
127e052a5a
commit
47bb0761e6
1 changed files with 4 additions and 3 deletions
|
|
@ -112,9 +112,10 @@ For the purposes of the Rust style, to compare two strings for version-sorting:
|
|||
- Compare the strings by (Unicode) character as normal, finding the index of
|
||||
the first differing character. (If the two strings do not have the same
|
||||
length, this may be the end of the shorter string.)
|
||||
- For both strings, determine the sequence of ASCII digits containing either
|
||||
that character or the character before. (If either string doesn't have such a
|
||||
sequence of ASCII digits, fall back to comparing the strings as normal.)
|
||||
- For both strings, determine the longest sequence of ASCII digits containing
|
||||
either that character or the character before. (If either string doesn't have
|
||||
such a sequence of ASCII digits, fall back to comparing the strings as
|
||||
normal.)
|
||||
- Compare the numeric values of the number specified by the sequence of digits.
|
||||
(Note that an implementation of this algorithm can easily check this without
|
||||
accumulating copies of the digits or converting to a number: after skipping
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue