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