Compare a part of a string
strncmp( const s1{}, const s2{}, len=sizeof(s1), ofs=0, ignorecase=false )
Compare a string to a substring.
s1 | Needle |
s2 | Haystack |
len | Max number of characters to compare |
ofs | Starting offset in s2 |
ignorecase | If true the comparison is case-insensitive |
0 is the strings are equal. Positive if s1 > s2, Negative is s1 < s2.
new mystring{} = "This is a test";
new x;
x = strncmp( "this", mystring, _, _, 1 );
// x = 0
x = strncmp( "is", mystring, _, 2, 0 );
// x = 0
x = strncmp( "iS", mystring, _, 2, 0 );
// x is negative