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

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

Issue 13874008: Remove String.slice. Too much overlap with String.substring. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add VM changes. Created 7 years, 8 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 * Creates a new string by concatenating this string with [other]. 132 * Creates a new string by concatenating this string with [other].
133 * 133 *
134 * A sequence of strings can be concatenated by using [Iterable.join]: 134 * A sequence of strings can be concatenated by using [Iterable.join]:
135 * 135 *
136 * var strings = ['foo', 'bar', 'geez']; 136 * var strings = ['foo', 'bar', 'geez'];
137 * var concatenated = strings.join(); 137 * var concatenated = strings.join();
138 */ 138 */
139 String operator +(String other); 139 String operator +(String other);
140 140
141 /** 141 /**
142 * Returns a slice of this string from [startIndex] to [endIndex].
143 *
144 * If [startIndex] is omitted, it defaults to the start of the string.
145 *
146 * If [endIndex] is omitted, it defaults to the end of the string.
147 *
148 * If either index is negative, it's taken as a negative index from the
149 * end of the string. Their effective value is computed by adding the
150 * negative value to the [length] of the string.
151 *
152 * The effective indices, after must be non-negative, no greater than the
153 * length of the string, and [endIndex] must not be less than [startIndex].
154 */
155 String slice([int startIndex, int endIndex]);
156
157 /**
158 * Returns a substring of this string in the given range. 142 * Returns a substring of this string in the given range.
159 * [startIndex] is inclusive and [endIndex] is exclusive. 143 * [startIndex] is inclusive and [endIndex] is exclusive.
160 */ 144 */
161 String substring(int startIndex, [int endIndex]); 145 String substring(int startIndex, [int endIndex]);
162 146
163 /** 147 /**
164 * Removes leading and trailing whitespace from a string. If the string 148 * Removes leading and trailing whitespace from a string. If the string
165 * contains leading or trailing whitespace a new string with no leading and 149 * contains leading or trailing whitespace a new string with no leading and
166 * no trailing whitespace is returned. Otherwise, the string itself is 150 * no trailing whitespace is returned. Otherwise, the string itself is
167 * returned. Whitespace is defined as every Unicode character in the Zs, Zl 151 * returned. Whitespace is defined as every Unicode character in the Zs, Zl
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 _position = position - 1; 439 _position = position - 1;
456 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); 440 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit);
457 return true; 441 return true;
458 } 442 }
459 } 443 }
460 _position = position; 444 _position = position;
461 _currentCodePoint = codeUnit; 445 _currentCodePoint = codeUnit;
462 return true; 446 return true;
463 } 447 }
464 } 448 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/js_string.dart ('k') | tests/corelib/string_slice_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698