OLD | NEW |
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 * A sequence of characters. | 8 * A sequence of characters. |
9 * | 9 * |
10 * A string can be either single or multiline. Single line strings are | 10 * A string can be either single or multiline. Single line strings are |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 * of times. | 353 * of times. |
354 * | 354 * |
355 * The result of `str * n` is equivalent to | 355 * The result of `str * n` is equivalent to |
356 * `str + str + ...`(n times)`... + str`. | 356 * `str + str + ...`(n times)`... + str`. |
357 * | 357 * |
358 * Returns an empty string if [times] is zero or negative. | 358 * Returns an empty string if [times] is zero or negative. |
359 */ | 359 */ |
360 String operator *(int times); | 360 String operator *(int times); |
361 | 361 |
362 /** | 362 /** |
363 * Pads this string on the left if it is shorther than [width]. | 363 * Pads this string on the left if it is shorter than [width]. |
364 * | 364 * |
365 * Return a new string that prepends [padding] onto this string | 365 * Return a new string that prepends [padding] onto this string |
366 * one time for each position the length is less than [width]. | 366 * one time for each position the length is less than [width]. |
367 * | 367 * |
368 * If [width] is already smaller than or equal to `this.length`, | 368 * If [width] is already smaller than or equal to `this.length`, |
369 * no padding is added. A negative `width` is treated as zero. | 369 * no padding is added. A negative `width` is treated as zero. |
370 * | 370 * |
371 * If [padding] has length different from 1, the result will not | 371 * If [padding] has length different from 1, the result will not |
372 * have length `width`. This may be useful for cases where the | 372 * have length `width`. This may be useful for cases where the |
373 * padding is a longer string representing a single character, like | 373 * padding is a longer string representing a single character, like |
374 * `" "` or `"\u{10002}`". | 374 * `" "` or `"\u{10002}`". |
375 * In that case, the user should make sure that `this.length` is | 375 * In that case, the user should make sure that `this.length` is |
376 * the correct measure of the strings length. | 376 * the correct measure of the strings length. |
377 */ | 377 */ |
378 String padLeft(int width, [String padding = ' ']); | 378 String padLeft(int width, [String padding = ' ']); |
379 | 379 |
380 /** | 380 /** |
381 * Pads this string on the right if it is shorther than [width]. | 381 * Pads this string on the right if it is shorter than [width]. |
382 * | 382 * |
383 * Return a new string that appends [padding] after this string | 383 * Return a new string that appends [padding] after this string |
384 * one time for each position the length is less than [width]. | 384 * one time for each position the length is less than [width]. |
385 * | 385 * |
386 * If [width] is already smaller than or equal to `this.length`, | 386 * If [width] is already smaller than or equal to `this.length`, |
387 * no padding is added. A negative `width` is treated as zero. | 387 * no padding is added. A negative `width` is treated as zero. |
388 * | 388 * |
389 * If [padding] has length different from 1, the result will not | 389 * If [padding] has length different from 1, the result will not |
390 * have length `width`. This may be useful for cases where the | 390 * have length `width`. This may be useful for cases where the |
391 * padding is a longer string representing a single character, like | 391 * padding is a longer string representing a single character, like |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 _position = position - 1; | 783 _position = position - 1; |
784 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); | 784 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); |
785 return true; | 785 return true; |
786 } | 786 } |
787 } | 787 } |
788 _position = position; | 788 _position = position; |
789 _currentCodePoint = codeUnit; | 789 _currentCodePoint = codeUnit; |
790 return true; | 790 return true; |
791 } | 791 } |
792 } | 792 } |
OLD | NEW |