KawaiKx KawaiKx - 5 months ago 10
Swift Question

length (byte-wise) of a string in swift 2.2

How do we find out the length (byte-wise) of a string

[declared String type, not NSString]
in Swift 2.2?

I know one way out is to use

Is there any other way out?


I think type casting is another easier way to use the methods, properties of NSString class.

print((str as NSString).length)