String length in Swift

      No Comments on String length in Swift

To get the string length in swift we have two options depending on swift version

  1. Swift 3
yourString.characters.count

//EXAMPLE

if yourString.characters.count == 0{

//do something
}

2. Swift 4

yourString.count

//EXAMPLE

if yourString.count == 0{
//do something
}

 

 

 

A pat on the back !!

Leave a Reply

Your email address will not be published. Required fields are marked *