SYNOPSIS<strncmp $a $b $len [$mode]>
<strnicmp $a $b $len [$mode]>
DESCRIPTIONstrncmp
and strnicmp
behave like strcmp
and
strcmpi
, respectively. However, each takes a third parameter
$len
which gives the maximum number of characters to compare
against the corresponding value of $b
. If $len
has
fewer values than $b
, its last value is re-used; if it has no
values, infinity is assumed (e.g. strcmp
behavior).
The optional $mode
argument is a
stringcomparemode
-style (here)
compare mode to use; the default is the current apicp
stringcomparemode, with "ignorecase" added for
strnicmp
. The $mode
values are used in the same order as
$b
values. The $mode
argument was added in version 6.
DIAGNOSTICSstrncmp
and strnicmp
return A*B integer values
(A and B being the number of values of $a
and $b
).
EXAMPLE<strncmp "this" "the" 2>
The return value in $ret
would be 0.
CAVEATS
Text is compared according to apicp stringcomparemode (with
"ignorecase" for strnicmp
) or the $mode
argument.
Lengths in $len
count characters, not bytes. For byte
counting, add "iso-8859-1" to $mode
.
SEE ALSOstrcmp
, strcmpi