| OLD | NEW |
| 1 library java.engine; | 1 library java.engine; |
| 2 | 2 |
| 3 import 'java_core.dart'; |
| 4 |
| 3 class StringUtilities { | 5 class StringUtilities { |
| 4 static const String EMPTY = ''; | 6 static const String EMPTY = ''; |
| 5 static const List<String> EMPTY_ARRAY = const <String> []; | 7 static const List<String> EMPTY_ARRAY = const <String> []; |
| 6 static String intern(String s) => s; | 8 static String intern(String s) => s; |
| 9 static bool isTagName(String s) { |
| 10 if (s == null || s.length == 0) { |
| 11 return false; |
| 12 } |
| 13 int sz = s.length; |
| 14 for (int i = 0; i < sz; i++) { |
| 15 int c = s.codeUnitAt(i); |
| 16 if (!Character.isLetter(c)) { |
| 17 if (i == 0) { |
| 18 return false; |
| 19 } |
| 20 if (!Character.isDigit(c) && c != 0x2D) { |
| 21 return false; |
| 22 } |
| 23 } |
| 24 } |
| 25 return true; |
| 26 } |
| 7 static String substringBefore(String str, String separator) { | 27 static String substringBefore(String str, String separator) { |
| 8 if (str == null || str.isEmpty) { | 28 if (str == null || str.isEmpty) { |
| 9 return str; | 29 return str; |
| 10 } | 30 } |
| 11 int pos = str.indexOf(separator); | 31 int pos = str.indexOf(separator); |
| 12 if (pos < 0) { | 32 if (pos < 0) { |
| 13 return str; | 33 return str; |
| 14 } | 34 } |
| 15 return str.substring(0, pos); | 35 return str.substring(0, pos); |
| 16 } | 36 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 41 static int combineHashCodes(int first, int second) => first * 31 + second; | 61 static int combineHashCodes(int first, int second) => first * 31 + second; |
| 42 } | 62 } |
| 43 | 63 |
| 44 class UUID { | 64 class UUID { |
| 45 static int __nextId = 0; | 65 static int __nextId = 0; |
| 46 final String id; | 66 final String id; |
| 47 UUID(this.id); | 67 UUID(this.id); |
| 48 String toString() => id; | 68 String toString() => id; |
| 49 static UUID randomUUID() => new UUID((__nextId).toString()); | 69 static UUID randomUUID() => new UUID((__nextId).toString()); |
| 50 } | 70 } |
| OLD | NEW |