swift 5 get first character of string
Swift 5
let str = "abcdef"
print( String(str.characters.prefix(1)) ) // output: "a"
print( String(str.characters.prefix(3)) ) // output: "abc"
Are there any code examples left?
New code examples in category Swift