Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

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"
 
PREVIOUS NEXT
Tagged: #swift #character #string
ADD COMMENT
Topic
Name
9+4 =