strlen()
Description
Return the length of a string.
Syntax
strlen(string[]);
Parameters
Variable | Input |
|---|---|
| The string to get the length from. |
Returns
The length of the string in characters (not the number of cells). The string length excludes the terminating “\0” character.
Function call example
Example of acquiring length of string
new data1[12] = [4, 8, 15, 14, 23, 42];
new array1[10]=''newText'';
new data3;
new data4;
main(){
data3 = strlen(data1); //result of data3 will be: 6
data4 = strlen(array1); //result of data4 will be: 7
while(1){
Delay(100);
}
}Notes and Warnings
Like all functions in this library, the function handles both packed and unpacked strings
To get the number of cells held by a packed string of a given length, you can use the predefined constants charbits and cellbits.