strlen — receiving the length of string.

Description:

u8 strlen(u8 *string);

Returns the string length of string in bytes.

List of parameters:

string

Input string or pointer to the string for which the length is measured.

Return values:

The string length of string in bytes in case of success and 0 if string is empty. For double byte character set string the result will be twice as large.

Example:

<item addr="524:248" name="Test for strlen function" type="script">
V-ID/V-ADDR {
    if(opt0()) {
    	// Example 1
    
    	u8 result_1 = strlen("It's the first string!");
    
    	// Example 2
    
    	u8 str[] = "what length of this string?";
    	u8 result_2 = strlen(&str);
    	
    	// Result output to the interface
    	u8 strForMess[50];
    	sprintf(strForMess, "%c result_1 = %d, result_2 = %d", 1, result_1, result_2);
    	setStatus(@exciterId():32, &strForMess);
    }
}
</item>
        

The result of performing the example in the interface:

result_1 = 22, result_2 = 27