How to find the length of a string in swift

Introduction :

String in swift is a collection of characters. To find the length of a string, swift string comes with a count property. Read the count and you will get the total character count.

Example of string.count :

Let’s take a look at the below example :

let string1 = "a"
let string2 = "a b"
let string3 = ""
let string4 = "!!"

print(string1.count)
print(string2.count)
print(string3.count)
print(string4.count)

It will print the below output :

1
3
0
2

Where is the color and why codevscolor ?

Long story short, I love paintings and I paint on weekends. We(me and my wife) have one Youtube channel. Don't forget to subscribe ❤️❤️🤩