Substring/Top and tail: Difference between revisions

m
Line 1,062:
 
=={{header|Swift}}==
Swift has generic functionality that works not only works on strings, but also on any type that conforms to relevant protocols. The first method presented here uses generic functions from Swift standard library:
<lang swift>let txt = "0123456789"
println(dropFirst(txt))
Line 1,071:
012345678
12345678</pre>
These functions are generic, not overloads:
<lang swift>let array = [0,1,2,3,4,5,6,7,8,9]
println(dropFirst(array))
Anonymous user