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

Side by Side Diff: runtime/lib/string_patch.dart

Issue 16285004: Better documentation on Sets and Maps, and more. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. 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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/lib/string_helper.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 patch class String { 5 patch class String {
6 /* patch */ factory String.fromCharCodes(Iterable<int> charCodes) { 6 /* patch */ factory String.fromCharCodes(Iterable<int> charCodes) {
7 return _StringBase.createFromCharCodes(charCodes); 7 return _StringBase.createFromCharCodes(charCodes);
8 } 8 }
9 } 9 }
10 10
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 // Returns this string if it does not have leading or trailing 260 // Returns this string if it does not have leading or trailing
261 // whitespaces. 261 // whitespaces.
262 return this; 262 return this;
263 } else { 263 } else {
264 return _substringUnchecked(first, last + 1); 264 return _substringUnchecked(first, last + 1);
265 } 265 }
266 } 266 }
267 267
268 bool contains(Pattern pattern, [int startIndex = 0]) { 268 bool contains(Pattern pattern, [int startIndex = 0]) {
269 if (pattern is String) { 269 if (pattern is String) {
270 if (startIndex < 0 || startIndex > this.length) {
271 throw new RangeError.range(startIndex, 0, this.length);
272 }
270 return indexOf(pattern, startIndex) >= 0; 273 return indexOf(pattern, startIndex) >= 0;
271 } 274 }
272 return pattern.allMatches(this.substring(startIndex)).iterator.moveNext(); 275 return pattern.allMatches(this.substring(startIndex)).isNotEmpty;
273 } 276 }
274 277
275 String replaceFirst(Pattern pattern, String replacement) { 278 String replaceFirst(Pattern pattern, String replacement) {
276 if (pattern is! Pattern) { 279 if (pattern is! Pattern) {
277 throw new ArgumentError("${pattern} is not a Pattern"); 280 throw new ArgumentError("${pattern} is not a Pattern");
278 } 281 }
279 if (replacement is! String) { 282 if (replacement is! String) {
280 throw new ArgumentError("${replacement} is not a String"); 283 throw new ArgumentError("${replacement} is not a String");
281 } 284 }
282 StringBuffer buffer = new StringBuffer(); 285 StringBuffer buffer = new StringBuffer();
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 class _CodeUnits extends Object with ListMixin<int>, 670 class _CodeUnits extends Object with ListMixin<int>,
668 UnmodifiableListMixin<int> { 671 UnmodifiableListMixin<int> {
669 /** The string that this is the code units of. */ 672 /** The string that this is the code units of. */
670 String _string; 673 String _string;
671 674
672 _CodeUnits(this._string); 675 _CodeUnits(this._string);
673 676
674 int get length => _string.length; 677 int get length => _string.length;
675 int operator[](int i) => _string.codeUnitAt(i); 678 int operator[](int i) => _string.codeUnitAt(i);
676 } 679 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/lib/string_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698