Updated: April 19, 2023 |
Compare two strings, using the locale's collating sequence
#include <string.h> int strcoll( const char* s1, const char* s2 );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The strcoll() function compares the strings pointed to by s1 and s2, using the collating sequence selected by the setlocale() function.
The strcoll() function is equivalent to strcmp() when the collating sequence is selected from the "C" locale.
#include <stdio.h> #include <string.h> #include <stdlib.h> char buffer[80] = "world"; int main( void ) { if( strcoll( buffer, "Hello" ) < 0 ) { printf( "Less than\n" ); } return EXIT_SUCCESS; }
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | Yes |
Signal handler | Yes |
Thread | Yes |