curl_strnequal.3 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. .\" generated by cd2nroff 0.1 from curl_strnequal.md
  2. .TH curl_strnequal 3 "2025-01-17" libcurl
  3. .SH NAME
  4. curl_strnequal \- compare two strings ignoring case
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. int curl_strnequal(const char *str1, const char *str2, size_t length);
  9. .fi
  10. .SH DESCRIPTION
  11. The \fIcurl_strnequal(3)\fP function compares the two strings \fIstr1\fP and \fIstr2\fP,
  12. ignoring the case of the characters. It returns a non\-zero (TRUE) integer if
  13. the strings are identical.
  14. This function compares no more than the first \fIlength\fP bytes of \fIstr1\fP and
  15. \fIstr2\fP.
  16. This function uses plain ASCII based comparisons completely disregarding the
  17. locale \- contrary to how \fBstrcasecmp\fP and other system case insensitive
  18. string comparisons usually work.
  19. This function is provided by libcurl to enable applications to compare strings
  20. in a truly portable manner. There are no standard portable case insensitive
  21. string comparison functions. This function works on all platforms.
  22. .SH PROTOCOLS
  23. This functionality affects all supported protocols
  24. .SH EXAMPLE
  25. .nf
  26. int main(int argc, char **argv)
  27. {
  28. const char *name = "compare";
  29. if(curl_strnequal(name, argv[1], 5))
  30. printf("Name and input matches in the 5 first bytes\\n");
  31. }
  32. .fi
  33. .SH AVAILABILITY
  34. Added in curl 7.1
  35. .SH RETURN VALUE
  36. Non\-zero if the strings are identical. Zero if they are not.
  37. .SH SEE ALSO
  38. .BR curl_strequal (3),
  39. .BR strcasecmp (3),
  40. .BR strcmp (3)