The remaining class is the StringBuf class, which is
used for creating very large strings from smaller strings.
The String Class
Many of the methods provided by the String class provide the means to treat strings as though they
were Arrays of characters. This offers a large amount of leverage to search and replace sections of a
string as you would items in an Array.
Table 3 - 10 provides a list of the String class methods.
Table 3-10
String Field Description
length : Int Returns the number of characters in a string; it
is a read-only property. Escape characters,
including forward slash, count as one character.
charAt(index : Int) : String Returns the character at a given location.
charCodeAt(index : Int) : Int Returns the ASCII representation of a
character at a given location.
indexOf(value : String,
?startIndex : Int) : Int
Returns the first location past a given starting
point of a given character or string.
lastIndexOf(value : String,
?startIndex : Int) : Int
Returns the first location past a given starting
point of a given character or string whereby
the string to search is traversed in reverse.
Pages:
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165