OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | |
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. | |
4 | |
5 library front_end.src.scanner.string_utilities; | |
6 | |
7 import 'package:front_end/src/scanner/interner.dart'; | |
8 | |
9 class StringUtilities { | |
10 static Interner INTERNER = new NullInterner(); | |
11 | |
12 static bool endsWith3(String str, int c1, int c2, int c3) { | |
Brian Wilkerson
2016/11/08 20:53:24
We might want to verify that these methods are sti
| |
13 var length = str.length; | |
14 return length >= 3 && | |
15 str.codeUnitAt(length - 3) == c1 && | |
16 str.codeUnitAt(length - 2) == c2 && | |
17 str.codeUnitAt(length - 1) == c3; | |
18 } | |
19 | |
20 static String intern(String string) => INTERNER.intern(string); | |
21 | |
22 static bool startsWith3(String str, int start, int c1, int c2, int c3) { | |
23 return str.length - start >= 3 && | |
24 str.codeUnitAt(start) == c1 && | |
25 str.codeUnitAt(start + 1) == c2 && | |
26 str.codeUnitAt(start + 2) == c3; | |
27 } | |
28 } | |
OLD | NEW |