CAPL Script

MbStrnCmp

Syntax

long mbstrncmp(char s1[], char s2[], long len); // form 1

long mbstrncmp(char s1[], char s2[], long s2offset, long len); // form 2

long mbstrncmp_off(char s1[], long s1offset, char s2[], long s2offset, long len); // form 3

Function

This function comparess1withs2for a maximum oflencharacters. If they are identical the functional result is 0.Ifs1is less thans2the result is -1, else +1. Comparison starts ins1ats1offset(form 3) and ins2ats2offset(form 2 and form 3).

Parameters

s1 First string

s2

Second string

len

Maximum number of characters to compare

s1offset

Offset ins1incharacters

s2offset

Offset ins2incharacters

Return Values

-1 if s1 is less than s2.

1 if s2 is less than s1.

0 if the strings are equal.

char s[50] = "'Tür' is the german word for 'door'.";write("%d", mbstrncmp_off(s, 13, "german", 0, 6)); // 0

strncmp | mbstrlen | mbstrncpy | mbstrstr