To find the length of a string in Swift, you can use the count
property of the string or the countElements()
function.
Here's an example using count
:
main.swift86 chars4 lines
And here's an example using countElements()
:
main.swift95 chars4 lines
Both methods will give you the length of the string, which in this case is 13.
gistlibby LogSnag