Compare first n
characters of strings
(case insensitive)
compares up to tf
= strncmpi(s1,s2
,n
)n
characters of s1
and
s2
, ignoring any differences in letter case. The function
returns 1
(true
) if the two are identical and
0
(false
) otherwise. Text is considered
identical if the content of each is the same up to the end or the first
n
characters, whichever comes first, ignoring case. The
return result tf
is of data type
logical
.
The first two input arguments can be any combination of string arrays, character vectors, and cell arrays of character vectors.
The strncmpi
function is intended
for comparison of text. If used on numeric arrays, strncmpi
always
returns 0
.
For case-sensitive text comparison, use strncmp
instead
of strncmpi
.
Although strncmpi
shares a name
with a C function, it does not follow the C language convention of
returning 0
when the text inputs match.
contains
| endsWith
| eq
| matches
| ne
| regexp
| startsWith
| strcmp
| strcmpi
| strfind
| strncmp