Subscripts
The following subscripts are available globally.
-
Returns a string object containing the characters of the String that lie within a given range.
Note
Will return a string with a length of
endIndex - startIndex
charactersWarning
Will crash if range include positions out of the string.
Declaration
Swift
public subscript(range: Range<Int>) -> String { get }
Parameters
range
Range of the string to be returned.
Return Value
Substring at given range.