String length in Swift

To get the string length in swift we have two options depending on swift version 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 }