substring(to:)
Returns a new string containing the characters of the receiver up to, but not including, the one at a given index.
Declaration
func substring(to: Int) -> StringParameters
- to:
An index. The value must lie within the bounds of the receiver, or be equal to the length of the receiver.
Raises an Rangeexception if (
anIndex- 1) lies beyond the end of the receiver.
Return Value
A new string containing the characters of the receiver up to, but not including, the one at anIndex. If anIndex is equal to the length of the string, returns a copy of the receiver.