Documentation - v7.16.0
    Preparing search index...

    Function computeBytesCount

    • Returns the byte count of a string, accounting for multi-byte characters.

      Uses a fast ASCII-only shortcut when the string contains no characters above U+007F; otherwise falls back to TextEncoder for an accurate count.

      Parameters

      • candidate: string

        The string to measure.

      Returns number

      The number of bytes the string occupies when UTF-8 encoded.