OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
7 | 7 |
8 library services.src.correction.strings; | 8 library services.src.correction.strings; |
9 | 9 |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 String removeStart(String str, String remove) { | 51 String removeStart(String str, String remove) { |
52 if (isEmpty(str) || isEmpty(remove)) { | 52 if (isEmpty(str) || isEmpty(remove)) { |
53 return str; | 53 return str; |
54 } | 54 } |
55 if (str.startsWith(remove)) { | 55 if (str.startsWith(remove)) { |
56 return str.substring(remove.length); | 56 return str.substring(remove.length); |
57 } | 57 } |
58 return str; | 58 return str; |
59 } | 59 } |
60 | 60 |
| 61 int compareStrings(String a, String b) { |
| 62 if (a == b) { |
| 63 return 0; |
| 64 } |
| 65 if (a == null) { |
| 66 return 1; |
| 67 } |
| 68 if (b == null) { |
| 69 return -1; |
| 70 } |
| 71 return a.compareTo(b); |
| 72 } |
| 73 |
61 String repeat(String s, int n) { | 74 String repeat(String s, int n) { |
62 StringBuffer sb = new StringBuffer(); | 75 StringBuffer sb = new StringBuffer(); |
63 for (int i = 0; i < n; i++) { | 76 for (int i = 0; i < n; i++) { |
64 sb.write(s); | 77 sb.write(s); |
65 } | 78 } |
66 return sb.toString(); | 79 return sb.toString(); |
67 } | 80 } |
OLD | NEW |