| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011, 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 /** | |
| 6 * The String class represents character strings. Strings are | |
| 7 * immutable. A string is represented by a list of 32-bit Unicode | |
| 8 * scalar character codes accessible through the [charCodeAt] or the | |
| 9 * [charCodes] method. | |
| 10 */ | |
| 11 interface String | |
| 12 extends Comparable, Hashable, Pattern | |
| 13 default StringImplementation { | |
| 14 /** | |
| 15 * Allocates a new String for the specified [charCodes]. | |
| 16 */ | |
| 17 String.fromCharCodes(List<int> charCodes); | |
| 18 | |
| 19 /** | |
| 20 * Gets the character (as [String]) at the given [index]. | |
| 21 */ | |
| 22 String operator [](int index); | |
| 23 | |
| 24 /** | |
| 25 * Gets the scalar character code at the given [index]. | |
| 26 */ | |
| 27 int charCodeAt(int index); | |
| 28 | |
| 29 /** | |
| 30 * The length of the string. | |
| 31 */ | |
| 32 int get length(); | |
| 33 | |
| 34 /** | |
| 35 * Returns whether the two strings are equal. This method compares | |
| 36 * each individual scalar character codes of the strings. | |
| 37 */ | |
| 38 bool operator ==(String other); | |
| 39 | |
| 40 /** | |
| 41 * Returns whether this string ends with [other]. | |
| 42 */ | |
| 43 bool endsWith(String other); | |
| 44 | |
| 45 /** | |
| 46 * Returns whether this string starts with [other]. | |
| 47 */ | |
| 48 bool startsWith(String other); | |
| 49 | |
| 50 /** | |
| 51 * Returns the first location of [other] in this string starting at | |
| 52 * [start] (inclusive). | |
| 53 * Returns -1 if [other] could not be found. | |
| 54 */ | |
| 55 int indexOf(String other, [int start]); | |
| 56 | |
| 57 /** | |
| 58 * Returns the last location of [other] in this string, searching | |
| 59 * backward starting at [start] (inclusive). | |
| 60 * Returns -1 if [other] could not be found. | |
| 61 */ | |
| 62 int lastIndexOf(String other, [int start]); | |
| 63 | |
| 64 /** | |
| 65 * Returns whether this string is empty. | |
| 66 */ | |
| 67 bool isEmpty(); | |
| 68 | |
| 69 /** | |
| 70 * Creates a new string by concatenating this string with [other]. | |
| 71 */ | |
| 72 String concat(String other); | |
| 73 | |
| 74 /** | |
| 75 * Returns a substring of this string in the given range. | |
| 76 * [startIndex] is inclusive and [endIndex] is exclusive. | |
| 77 */ | |
| 78 String substring(int startIndex, [int endIndex]); | |
| 79 | |
| 80 /** | |
| 81 * Returns a new string where leading and trailing whitespaces of | |
| 82 * this string have been removed, or returns this string if it does | |
| 83 * not have leading and trailing whitespaces. | |
| 84 */ | |
| 85 String trim(); | |
| 86 | |
| 87 /** | |
| 88 * Returns whether this string contains [other] starting | |
| 89 * at [startIndex] (inclusive). | |
| 90 */ | |
| 91 bool contains(Pattern other, [int startIndex]); | |
| 92 | |
| 93 /** | |
| 94 * Returns a new string where the first occurence of [from] in this string | |
| 95 * is replaced with [to]. | |
| 96 */ | |
| 97 String replaceFirst(Pattern from, String to); | |
| 98 | |
| 99 /** | |
| 100 * Returns a new string where all occurences of [from] in this string | |
| 101 * are replaced with [to]. | |
| 102 */ | |
| 103 String replaceAll(Pattern from, String to); | |
| 104 | |
| 105 /** | |
| 106 * Splits the string around matches of [pattern]. Returns | |
| 107 * a list of substrings. | |
| 108 */ | |
| 109 List<String> split(Pattern pattern); | |
| 110 | |
| 111 /** | |
| 112 * Returns a list of the characters of this string. | |
| 113 */ | |
| 114 List<String> splitChars(); | |
| 115 | |
| 116 /** | |
| 117 * Returns a list of the scalar character codes of this string. | |
| 118 */ | |
| 119 List<int> charCodes(); | |
| 120 | |
| 121 /** | |
| 122 * If this string is not already all lower case, returns a new string | |
| 123 * where all characters are made lower case. Returns [:this:] otherwise. | |
| 124 */ | |
| 125 String toLowerCase(); | |
| 126 | |
| 127 /** | |
| 128 * If this string is not already all uper case, returns a new string | |
| 129 * where all characters are made upper case. Returns [:this:] otherwise. | |
| 130 */ | |
| 131 String toUpperCase(); | |
| 132 } | |
| OLD | NEW |