This function calculates the length of the string.
int @strlen(stirng buf);
Parameters
string buf : string to know the length
Return
Value
It returns the number of characters in string
Example1)
length = @strlen("1234");
Description : the ¡®length¡¯ is 4 that is
the number of characters in ¡°1234¡±.
Example2)
length = @strlen("Analog");
Description : the ¡®length¡¯ is 6 that is
the number of characters in ¡°Analog¡±.
Example3)
$AI_0001=1234;
@sprintf(buf, "%d",
$AI_0001);
length = @strlen(buf);
Description : The AI_0001 is
a Analog Input tag. The value of AI_0001 is
converted
to a string using @sprintf() function and is
stored in the variable ¡®buf¡¯ (char type). And then it
finds the length. As a result, the ¡®length¡¯ is 4.
buf[0] = "aaaa";
buf[1] = "bbbbb";
stringlength = @strlen(buf[0]); // Returns a "aaaa" length of 4.
arraylength = @strlen(buf); // Returns the array length of the buf.
(Supported in version 10.3.6.24 and later)
Sentence description: If the
size was 3 when declaring the buf variable, 3 is stored in the array length.
Related Helps)