| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library dart.pkg.collection.comparators; | 5 library dart.pkg.collection.comparators; |
| 6 | 6 |
| 7 // Character constants. | 7 // Character constants. |
| 8 const int _zero = 0x30; | 8 const int _zero = 0x30; |
| 9 const int _upperCaseA = 0x41; | 9 const int _upperCaseA = 0x41; |
| 10 const int _upperCaseZ = 0x5b; | 10 const int _upperCaseZ = 0x5a; |
| 11 const int _lowerCaseA = 0x61; | 11 const int _lowerCaseA = 0x61; |
| 12 const int _lowerCaseZ = 0x7b; | 12 const int _lowerCaseZ = 0x7a; |
| 13 const int _asciiCaseBit = 0x20; | 13 const int _asciiCaseBit = 0x20; |
| 14 | 14 |
| 15 /// Checks if strings [a] and [b] differ only on the case of ASCII letters. | 15 /// Checks if strings [a] and [b] differ only on the case of ASCII letters. |
| 16 /// | 16 /// |
| 17 /// Strings are equal if they have the same length, and the characters at | 17 /// Strings are equal if they have the same length, and the characters at |
| 18 /// each index are the same, or they are ASCII letters where one is upper-case | 18 /// each index are the same, or they are ASCII letters where one is upper-case |
| 19 /// and the other is the lower-case version of the same letter. | 19 /// and the other is the lower-case version of the same letter. |
| 20 /// | 20 /// |
| 21 /// The comparison does not ignore the case of non-ASCII letters, so | 21 /// The comparison does not ignore the case of non-ASCII letters, so |
| 22 /// an upper-case ae-ligature (Æ) is different from | 22 /// an upper-case ae-ligature (Æ) is different from |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 /// If there is no non-zero digits before, then leading zeros at [index] | 390 /// If there is no non-zero digits before, then leading zeros at [index] |
| 391 /// are also ignored when comparing numerically. If there is a non-zero digit | 391 /// are also ignored when comparing numerically. If there is a non-zero digit |
| 392 /// before, then zeros at [index] are significant. | 392 /// before, then zeros at [index] are significant. |
| 393 bool _isNonZeroNumberSuffix(String string, int index) { | 393 bool _isNonZeroNumberSuffix(String string, int index) { |
| 394 while (--index >= 0) { | 394 while (--index >= 0) { |
| 395 int char = string.codeUnitAt(index); | 395 int char = string.codeUnitAt(index); |
| 396 if (char != _zero) return _isDigit(char); | 396 if (char != _zero) return _isDigit(char); |
| 397 } | 397 } |
| 398 return false; | 398 return false; |
| 399 } | 399 } |
| OLD | NEW |