Empty Strings

Empty Strings can be initialized as follows:

// Initializing an Empty String 
var anEmptyString = ""
var anotherEmptyString = String()

These two strings are both empty and equivalent to each other. To find out whether a String is empty, the isEmpty property can be used as follows:

if anEmptyString.isEmpty { 
print("String is empty")
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset