CAPL Script

MbStrLen

This reference collection includes Vector documentation reproduced with permission. Snippets may require configuration-specific symbols and are not all standalone programs. Sources and validation limits.

Syntax

long mbstrlen(char s[]);

Function

The functional result is the length of the stringsincharacters.

Parameters

string

Return Values

Length of the string in characters.

Reference example from the CANoe 12 help. Check the required configuration, database objects and API availability in your installed version; this is not a recorded compiler or runtime test.

long length;
char s1[10] = "door";
char s2[10] = "Tür";
write("%d %d", mbstrlen(s1), strlen(s1)); // 4 4
write("%d %d", mbstrlen(s2), strlen(s2)); // 3 [3 or 4 depending on file encoding]

strlen | mbstrncmp | mbstrncpy