rcutils  master
C API providing common utilities and data structures.
Functions
strcasecmp.h File Reference
#include "rcutils/macros.h"
#include "rcutils/visibility_control.h"
Include dependency graph for strcasecmp.h:

Go to the source code of this file.

Functions

int rcutils_strcasecmp (const char *s1, const char *s2, int *value)
 Case insensitive string compare. More...
 
int rcutils_strncasecmp (const char *s1, const char *s2, size_t n, int *value)
 Case insensitive string compare up to count characters. More...
 

Function Documentation

◆ rcutils_strcasecmp()

int rcutils_strcasecmp ( const char *  s1,
const char *  s2,
int *  value 
)

Case insensitive string compare.

This function compares two strings ignoring case in a portable way. This performs a byte-by-byte comparison of the strings s1 and s2, ignoring the case of the characters.

Parameters
[in]s1Null terminated string to compare.
[in]s2Null terminated string to compare.
[out]valuePointer to comparison result. An integer less than, equal to, or greater than zero if s1 is, after ignoring case, found to be less than, to match, or be greater than s2, respectively.
Returns
0 if method succeeded, or
-1 if failed.

◆ rcutils_strncasecmp()

int rcutils_strncasecmp ( const char *  s1,
const char *  s2,
size_t  n,
int *  value 
)

Case insensitive string compare up to count characters.

This function compares two strings ignoring case in a portable way. This performs a byte-by-byte comparison of the strings s1 and s2 up to count characters of s1 and s2, ignoring the case of the characters.

Parameters
[in]s1First string to compare.
[in]s2Second string to compare.
[in]nCount of characters to compare.
[out]valuePointer to comparison result. An integer less than, equal to, or greater than zero if s1 is, after ignoring case, found to be less than, to match, or be greater than s2, respectively.
Returns
0 if method succeeded, or
-1 if failed.