Get the First Character of String in Swift

September 27, 2017

To get the first character of String you can use the following code

var str: String = "string 1 "
print ("First charter of string : \(str[str.startIndex])")

Output
First charter of string : s