strncmp
strncmp(t_string1t_string2x_max) => 1 / 0 / -1
Description
Compares two argument strings alphabetically only up to a maximum number of characters.
Similar to strcmp except that only up to x_max characters are compared. To test if the contents of two strings are the same, use the equal function.
Arguments
|
Maximum number of characters in both strings to be compared. |
Value Returned
For the first specified number of characters:
Examples
strncmp( "abc" "ab" 3)
=> 1
strncmp( "abc" "de" 4)
=> -1
strncmp( "abc" "ab" 2)
=> 0
Related Topics
Return to top