How to check if string is empty in Swift

1 Answer

0 votes
var s = ""

if s.isEmpty {
   print( "string is empty" )
} else {
   print( "string is not empty" )
}




/*
run:
   
string is empty
  
*/

 



answered Feb 9, 2021 by avibootz
...