How to check if a string is empty in Swift

1 Answer

0 votes
var s: String = ""

if s.isEmpty {
    print("yes")
} else {
    print("no")
}



/*
run:

yes

*/

 



answered Nov 6, 2024 by avibootz
...