Ok, I am a beginner at c++ and I cannot figure out the best way to compare a string to multiple strings....
Basically I want something to do this:
1. User enters name such as John Doe, but I want it to not matter if they type it in uppercase, lowercase, etc.
2. Name is checked against multiple strings such as...(john doe) (John Doe) (JOHN DOE)
3. if the name the user enters matches one of those the result is 0, or something similar.
What is the best way to do this? Is there a way that I could just type one string to compare it to the name the user enters instead of every possibility? So I need a way to compare it disregarding the uppercase, lowercase....I think.
Thanks for any help!
Also, I can never think of any programs to make for practice, is there a website with some ideas?
Question
PricklyPoo
Ok, I am a beginner at c++ and I cannot figure out the best way to compare a string to multiple strings....
Basically I want something to do this:
1. User enters name such as John Doe, but I want it to not matter if they type it in uppercase, lowercase, etc.
2. Name is checked against multiple strings such as...(john doe) (John Doe) (JOHN DOE)
3. if the name the user enters matches one of those the result is 0, or something similar.
What is the best way to do this? Is there a way that I could just type one string to compare it to the name the user enters instead of every possibility? So I need a way to compare it disregarding the uppercase, lowercase....I think.
Thanks for any help!
Also, I can never think of any programs to make for practice, is there a website with some ideas?
Link to comment
https://www.neowin.net/forum/topic/615897-how-to-compare-1-string-against-multiple-strings/Share on other sites
17 answers to this question
Recommended Posts