curl_strequal.md (1281B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: curl_strequal 5 Section: 3 6 Source: libcurl 7 See-also: 8 - curl_strnequal (3) 9 - strcasecmp (3) 10 - strcmp (3) 11 Protocol: 12 - All 13 Added-in: 7.1 14 --- 15 16 # NAME 17 18 curl_strequal - compare two strings ignoring case 19 20 # SYNOPSIS 21 22 ~~~c 23 #include <curl/curl.h> 24 25 int curl_strequal(const char *str1, const char *str2); 26 ~~~ 27 28 # DESCRIPTION 29 30 The curl_strequal(3) function compares the two strings *str1* and *str2*, 31 ignoring the case of the characters. It returns a non-zero (TRUE) integer if 32 the strings are identical. 33 34 This function uses plain ASCII based comparisons completely disregarding the 35 locale - contrary to how **strcasecmp** and other system case insensitive 36 string comparisons usually work. 37 38 This function is provided by libcurl to enable applications to compare strings 39 in a truly portable manner. There are no standard portable case insensitive 40 string comparison functions. This function works on all platforms. 41 42 # %PROTOCOLS% 43 44 # EXAMPLE 45 46 ~~~c 47 int main(int argc, char **argv) 48 { 49 const char *name = "compare"; 50 if(curl_strequal(name, argv[1])) 51 printf("Name and input matches\n"); 52 } 53 ~~~ 54 55 # %AVAILABILITY% 56 57 # RETURN VALUE 58 59 Non-zero if the strings are identical. Zero if they are not.