Length of a string in letters.
Length of a string in letters. This function ascertains how long a string is by searching for the concluding 0. Multibyte UTF8-letters are counted as one! If the string is not 0-terminated, the call can lead to significant errors.
This function does not give a response to how much memory is reserved for a string, this is something the script programmer should pay attention to him/herself.
Name | Type | Default | Description |
Return | int | Length of the string without the concluding 0 | |
s | char* | - | 0-terminated string |
countBytes | int | 0 | Count letters or bytes? 0 : Letters 1 : Bytes |
char * s = alloc (10000); if (!s) return; strcpy (s, "abcdefg"); showmessage ("%d", strlen (s)); // 7 release (s);
Alphabetic index HTML hierarchy of classes or Java