How to convert the string to uppercase before performing a compare, or is it possible to compare the string by ignoring the case
if (Convert.ToString(txt_SecAns.Text.Trim()).ToUpper() ==
Convert.ToString(hidden_secans.Value).ToUpper())
The equalsIgnoreCase() method compares two strings, ignoring lower case and upper case differences. This method returns true if the strings are equal, and false if not. Tip: Use the compareToIgnoreCase() method to compare two strings lexicographically, ignoring case differences.
How to make strcmp/strncmp case-insensitive in C/C++ To make strcmp case-insensitive, use strcasecmp from #include <strings. h> . strcasecmp can be used in exactly the same way as strcmp.
The strcasecmp() function compares, while ignoring differences in case, the string pointed to by string1 to the string pointed to by string2. The string arguments to the function must contain a NULL character (\0) marking the end of the string.
The _memicmp function compares the first count characters of the two buffers buffer1 and buffer2 byte by byte. The comparison is not case-sensitive.
use this:
var result = String.Compare("AA", "aa", StringComparison.OrdinalIgnoreCase);
String.Compare Method (String, String, Boolean)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With