Instance Property

length

The number of UTF-16 code units in the receiver.

Declaration

var length: Int { get }

Discussion

This number includes the individual characters of composed character sequences, so you cannot use this property to determine if a string will be visible when printed or how long it will appear.

See Also

Getting a String’s Length

func lengthOfBytes(using: UInt)

Returns the number of bytes required to store the receiver in a given encoding.

func maximumLengthOfBytes(using: UInt)

Returns the maximum number of bytes needed to store the receiver in a given encoding.