-
compare two strings
whats the best way for comparing 2 string to check if they are equal
i know that 1 ways is with strcmp(string1,string2) but i want to compare them, first with upper and lower letters make them different and second without upper and lower sensitivity
1st: "test Test" == the same
2st:"test Test"== different
strcmp always check the upper and lower option
-
Write your own function in which you will test each pair of characters in both strings. You can use one of these functions from ctype.h :
isupper()
islower()
toupper()
tolower()
-
You can also compare each character with ASCII values to determine upper and lower.
ASCII Code - The extended ASCII table
-
You could also look into using
strcasecmp, strncasecmp - case-insensitive string comparisons