curl_strequal.3 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .TH curl_strequal 3 "30 April 2004" "libcurl 7.12" "libcurl Manual"
  25. .SH NAME
  26. curl_strequal, curl_strnequal - case insensitive string comparisons
  27. .SH SYNOPSIS
  28. .nf
  29. #include <curl/curl.h>
  30. int curl_strequal(char *str1, char *str2);
  31. int curl_strnequal(char *str1, char *str2, size_t length);
  32. .fi
  33. .SH DESCRIPTION
  34. The
  35. .B curl_strequal()
  36. function compares the two strings \fIstr1\fP and \fIstr2\fP, ignoring the case
  37. of the characters. It returns a non-zero (TRUE) integer if the strings are
  38. identical.
  39. .sp
  40. The \fBcurl_strnequal()\fP function is similar, except it only compares the
  41. first \fIlength\fP characters of \fIstr1\fP.
  42. .sp
  43. These functions are provided by libcurl to enable applications to compare
  44. strings in a truly portable manner. There are no standard portable case
  45. insensitive string comparison functions. These two work on all platforms.
  46. .SH EXAMPLE
  47. .nf
  48. if(curl_strequal(name, input))
  49. printf("Name and input matches\\n");
  50. if(curl_strnequal(name, input, 5))
  51. printf("Name and input matches in the 5 first bytes\\n");
  52. .fi
  53. .SH AVAILABILITY
  54. Always
  55. .SH RETURN VALUE
  56. Non-zero if the strings are identical. Zero if they are not.
  57. .SH "SEE ALSO"
  58. .BR strcmp "(3), " strcasecmp "(3)"