CRE Programmer's Guide

String and Memory Block Functions
Common Run-Time Environment (CRE) Programmer’s Guide528146-004
8-23
Strncmp
! fir gets ["FrontBa",0]
@temp := RTL_Strncat_(fir, sec, 2);
Strncmp
The Strncmp functions compare two strings for a specified maximum number of
characters.
str1
is a pointer to the first string.
str2
is a pointer to the second string.
max_bytes
specifies the maximum number of characters to compare. max_bytes must be a
positive number.
Return Value
Strncmp returns a value that is
< 0 if str1 < str2
0 if str1 = str2
> 0 if str1 > str2
Considerations
Both str1 and str2 must be terminated by a zero (null) byte to stop the scan.
For less-than and greater-than comparisons, characters in str1 and str2 are
compared using the characters’ values in the ASCII collating sequence.
If one of the strings has fewer than max_bytes characters and matches the
beginning of the other string, the shorter string is defined to be less than the longer
string, even if the length of the longer string is greater than the length specified by
max_bytes.
INT PROC RTL_Strncmp_( str1, str2, max_bytes );
STRING .str1; ! in
STRING .str2; ! in
INT max_bytes; ! in TNS only
INT PROC RTL_StrncmpX_( str1, str2, max_bytes );
STRING .EXT str1; ! in
STRING .EXT str2; ! in
INT(32) max_bytes; ! in TNS only