var newStr : String = str.charAt(3); // will return `e` from ???haXe and Neko???
var newInt : Int = str.charCodeAt(3); // will return 101 from ???haXe and Neko???
var newStr : String = str.substr(2, 4); // will return `Xe a`
Searching a String
In most situations, you will need to search through a string before you know what part of that string you
want to return. For example, you may be parsing a configuration file with properties and their values
and want to store the values into a Hash Table using the properties as a key. To search a string, you use
the indexOf method, which requires the string or character you want to find in the string you are
searching. You can also choose to provide a second parameter, which is the location you want to start
your search, though it is optional. When the character or string is found in the parent string, the location
is returned, while if no instance of the character or string is found, then - 1 is returned:
var location : Int = str.indexOf(???e???); // will return 3 from ???haXe and Neko???
var location : Int = str.
Pages:
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167