Swift Functional Programming(Second Edition)
上QQ阅读APP看书,第一时间看更新

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")
}