1curl_strequal(3) libcurl curl_strequal(3)
2
3
4
6 curl_strequal, curl_strnequal - case insensitive string comparisons
7
9 #include <curl/curl.h>
10
11 int curl_strequal(char *str1, char *str2);
12 int curl_strnequal(char *str1, char *str2, size_t length);
13
15 The curl_strequal() function compares the two strings str1 and str2,
16 ignoring the case of the characters. It returns a non-zero (TRUE) inte‐
17 ger if the strings are identical.
18
19 The curl_strnequal() function is similar, except it only compares the
20 first length characters of str1.
21
22 These functions are provided by libcurl to enable applications to com‐
23 pare strings in a truly portable manner. There are no standard portable
24 case insensitive string comparison functions. These two work on all
25 platforms.
26
28 if(curl_strequal(name, input))
29 printf("Name and input matches\n");
30 if(curl_strnequal(name, input, 5))
31 printf("Name and input matches in the 5 first bytes\n");
32
34 Always
35
37 Non-zero if the strings are identical. Zero if they are not.
38
40 strcmp(3), strcasecmp(3)
41
42
43
44libcurl 8.2.1 April 26, 2023 curl_strequal(3)