TinyMUX

Strmem()

Functions

FUNCTION: strmem(<string>)

Returns the number of bytes required to store <string> in memory. For ASCII text, this equals strlen(). For UTF-8 text, characters outside the ASCII range use 2 to 4 bytes each.

Example:

> say strmem(This is a test)
You say, "14"
> say strmem([chr(233)])
You say, "2"

In the second example, é (U+00E9) takes 2 bytes in UTF-8 encoding, but strlen() would return 1.

Related Topics: strlen(), UNICODE.