Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: sdk/lib/core/string.dart

Issue 17281002: Make String.startsWith take an optional start index. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of dart.core; 5 part of dart.core;
6 6
7 /** 7 /**
8 * The String class represents sequences of characters. Strings are 8 * The String class represents sequences of characters. Strings are
9 * immutable. A string is represented by a sequence of Unicode UTF-16 9 * immutable. A string is represented by a sequence of Unicode UTF-16
10 * code units accessible through the [codeUnitAt] or the 10 * code units accessible through the [codeUnitAt] or the
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 */ 99 */
100 bool operator ==(var other); 100 bool operator ==(var other);
101 101
102 /** 102 /**
103 * Returns whether this string ends with [other]. 103 * Returns whether this string ends with [other].
104 */ 104 */
105 bool endsWith(String other); 105 bool endsWith(String other);
106 106
107 /** 107 /**
108 * Returns whether this string starts with a match of [pattern]. 108 * Returns whether this string starts with a match of [pattern].
109 *
110 * If [index] is provided, instead check if the substring starting
floitsch 2013/06/17 16:07:15 If [index] is provided, checks if `this` starts wi
111 * at that index starts with [pattern].
112 *
113 * It is an error if [index] is negative or greater than [length].
109 */ 114 */
110 bool startsWith(Pattern pattern); 115 bool startsWith(Pattern pattern, [int index = 0]);
111 116
112 /** 117 /**
113 * Returns the first position of a match of [pattern] in this string, 118 * Returns the first position of a match of [pattern] in this string,
114 * starting at [start] (inclusive). 119 * starting at [start] (inclusive).
115 * 120 *
116 * Returns -1 if a match could not be found. 121 * Returns -1 if a match could not be found.
117 * 122 *
118 * It is an error if start is negative or greater than [length]. 123 * It is an error if start is negative or greater than [length].
119 */ 124 */
120 int indexOf(Pattern pattern, [int start]); 125 int indexOf(Pattern pattern, [int start]);
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 _position = position - 1; 477 _position = position - 1;
473 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); 478 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit);
474 return true; 479 return true;
475 } 480 }
476 } 481 }
477 _position = position; 482 _position = position;
478 _currentCodePoint = codeUnit; 483 _currentCodePoint = codeUnit;
479 return true; 484 return true;
480 } 485 }
481 } 486 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698