Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Return the length in bytes of a string, optionally using a given encoding. Allowed encodings include UTF-8, UTF-16, ASCII, CP1252 and ISO-8859-1.

Syntax

byteLength(string, encoding)

ArgumentTypeDescription
stringStringThe string to be processed.
encodingStringThe character encoding to use.

Examples

byteLength('ab\u1e09', 'UTF-8')

Returns 5 (, which is the length of the string in bytes when using the UTF-8 encoding).


substring("01223236023",6byteLength('ab\u1e09', 'UTF-8')

This expression also returns 5, as the default encoding is UTF-8.

...