Instance Method


Returns the length in char-sized units of the receiver’s C-string representation in the default C-string encoding.


func cStringLength() -> Int


Raises if the receiver can’t be represented in the default C-string encoding without loss of information. You can also use canBeConverted(to:) to check whether a string can be losslessly converted to the default C-string encoding. If it can’t, use lossyCString() to get a C-string representation with some loss of information, then check its length explicitly using the ANSI function strlen().

See Also

Related Symbols

var utf8String: UnsafePointer<Int8>?

A null-terminated UTF8 representation of the string.

func maximumLengthOfBytes(using: UInt)

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

func lengthOfBytes(using: UInt)

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