Jump to content

Hey I was just coding in C++ well practicing im not the best at it and I was just wondering on how to check for case sensitivity when crosschecking two strings as like a password check. I want to do it within the clause of an if statement. I couldnt seem to find any information about this on the web.

Link to comment
https://linustechtips.com/topic/577505-c-case-sensitivity/
Share on other sites

Link to post
Share on other sites

1 minute ago, AlexTheRose said:

What do you mean, “check for case sensitivity?” Strings don’t have a property that defines them as sensitive or insensitive to “casing.” You can use the C library function toupper() or tolower() to convert a string to all uppercase/lowercase and then compare the two insensitively. By default differently cased strings with the same letters will not match.

 

Keep in mind: The C library function I mentioned, as well as the operation @FedeWar mentioned, only works for ASCII strings. So you’ll have to look for a library to handle non-Latin characters.

Oh shit thank you. 

Link to comment
https://linustechtips.com/topic/577505-c-case-sensitivity/#findComment-7553357
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×