- Swift Functional Programming(Second Edition)
- Dr. Fatih Nayebi
- 56字
- 2021-07-02 23:54:25
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")
}