TinyMUX

Strlen()

Functions

FUNCTION: strlen(<string>)

Returns the number of visual characters (grapheme clusters) in <string>. A grapheme cluster is what a user perceives as a single character, which may consist of one or more Unicode code points (such as a base letter with combining accents). ANSI color codes do not count.

Use strmem() to get the number of bytes instead, or vwidth() to get the display width in console columns (where wide characters count as two).

Example:

> say strlen(This is a test)
You say, "14"
> say strlen(Would you like coffee, or perhaps tea)
You say, "37"
> say strlen([chr(233)])
You say, "1"

Related Topics: strmem(), vwidth(), UNICODE.