Is there a way to ignore uppercase and lowercase? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is there a way to ignore uppercase and lowercase?

I'd like to ignore uppercase and lowercase word so for example Pach =pach pach= Pach PaCh==pach And so on and so forth

18th Jul 2019, 10:39 PM
Cout
Cout - avatar
33 Answers
+ 1
R4Z7 VS can include that header, but the problem is that I don't found such function in the header. You can see it in http://www.cplusplus.com/reference/cstring/ Are you sure it's the right header?
18th Jul 2019, 11:19 PM
Agent_I
Agent_I - avatar
+ 2
So your question is very much incomplete. It keeps getting more and more complicated each time someone asks you a question. You should outline your ENTIRE problem in the details of the question. With your latest comment about a "computer file" I have EVEN MORE questions about your problems. So, please, tell us everything you are doing and what you need help with. 1. The user will be inputting information? Is it string data? 2. What is this file you speak of? What format is it in? 3. What do you mean by searching the file? Will the user be searching for the data that they input earlier? 4. What are you trying to solve by comparing strings without case sensitivity?
19th Jul 2019, 1:10 AM
Zeke Williams
Zeke Williams - avatar
+ 1
Zeke Williams 1. The user is inputting a string 2. I am talking about this - I have a path for example my desktop and it "scans" all the files in the desktop 3+4. The search string is what the user inputs if the user input for example "Minecraft" and I have in my desktop "Minecraft launcher", "Minecraft server" it would find both. My problem is if the user inputs "minecraft" it won't find any of them because of the cases
19th Jul 2019, 1:14 AM
Cout
Cout - avatar
+ 1
Ok, so I'm very unfamiliar with newer versions of C++ and I wish I knew of one place I could familiarize myself. Like cplusplus.com for C++11. I wonder if cppreference.com has C++17 info. Anyways, I have done a little research on filesystem::directory_iterator(). Apparently, the entry.path() has a type that is interchangeable with strings. So you can do exactly as I was suggesting before with toupper or tolower. I would convert the path to all lower and then the search string to all lower. THEN I would use the find() function like you are doing in that code. You're welcome R4Z7
19th Jul 2019, 2:02 AM
Zeke Williams
Zeke Williams - avatar
+ 1
R4Z7 convert the input to lower too
19th Jul 2019, 1:30 PM
Zeke Williams
Zeke Williams - avatar
+ 1
Zeke Williams I did it in anthoer smart way. My project there is done. I am starting a new project with threads in winapi thank you for helping though
19th Jul 2019, 3:23 PM
Cout
Cout - avatar
0
You can't, C++ is a case-sensitive language and that's how it is
18th Jul 2019, 11:02 PM
Agent_I
Agent_I - avatar
0
Agent_I you are telling me that there is no way of doing this?
18th Jul 2019, 11:03 PM
Cout
Cout - avatar
0
R4Z7 Yep, like I said, C++ is case-sensitive
18th Jul 2019, 11:04 PM
Agent_I
Agent_I - avatar
0
Agent_I nha I just found a way. Strcasecmp
18th Jul 2019, 11:04 PM
Cout
Cout - avatar
0
R4Z7 Wait, are you referring to string data type or the language itself?
18th Jul 2019, 11:07 PM
Agent_I
Agent_I - avatar
0
Agent_I String data
18th Jul 2019, 11:08 PM
Cout
Cout - avatar
0
R4Z7 Ah, if so, then you can. Sorry, your question is a bit ambiguous
18th Jul 2019, 11:09 PM
Agent_I
Agent_I - avatar
0
Agent_I Yeah, I guess I didn't explain it to well
18th Jul 2019, 11:10 PM
Cout
Cout - avatar
0
Agent_I it doesn't work visual studio 2019 doesn't recognize string.h
18th Jul 2019, 11:11 PM
Cout
Cout - avatar
0
R4Z7 Try cstring, did you say the function is called strcasecmp?
18th Jul 2019, 11:15 PM
Agent_I
Agent_I - avatar
0
Agent_I Yeah, but before hand I need to #include <string.h>
18th Jul 2019, 11:16 PM
Cout
Cout - avatar
0
Agent_I Ah, cstring =string.h?
18th Jul 2019, 11:20 PM
Cout
Cout - avatar
0
R4Z7 Yes it's the same, but I can't find a function called strcasecmp in that header
18th Jul 2019, 11:21 PM
Agent_I
Agent_I - avatar
0
Agent_I it's probably because you didn't put an int before it
18th Jul 2019, 11:23 PM
Cout
Cout - avatar