In this tutorial, we are going to learn about how to find the length of a given string in Swift language.
To get the length of a string, we can use the built-in
count property in Swift.
countproperty returns the total number of characters in a string, it is read-only.
Here is an example, that gets the length of a
// the string has 4 characters let name = "King" print(name.count)
Swift version: 5.1