Anonymous user
Substring/Top and tail: Difference between revisions
→{{header|Swift}}
Line 1,079:
=={{header|Swift}}==
Swift strings are native Unicode strings and do not index through the code points. Swift's <code>String.Index</code> refers to true Unicode characters (Unicode grapheme clusters). Swift standard library has generic functionality that not only works with strings, but also with any type that conforms to relevant protocols. The first method presented here uses generic functions from Swift standard library:
<lang swift>let txt = "0123456789"
|