+ 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
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?
+ 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?
+ 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
+ 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
+ 1
R4Z7 convert the input to lower too
+ 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
0
You can't, C++ is a case-sensitive language and that's how it is
0
Agent_I you are telling me that there is no way of doing this?
0
R4Z7
Yep, like I said, C++ is case-sensitive
0
Agent_I nha I just found a way. Strcasecmp
0
R4Z7
Wait, are you referring to string data type or the language itself?
0
Agent_I String data
0
R4Z7
Ah, if so, then you can. Sorry, your question is a bit ambiguous
0
Agent_I Yeah, I guess I didn't explain it to well
0
Agent_I it doesn't work visual studio 2019 doesn't recognize string.h
0
R4Z7
Try cstring, did you say the function is called strcasecmp?
0
Agent_I Yeah, but before hand I need to #include <string.h>
0
Agent_I Ah, cstring =string.h?
0
R4Z7
Yes it's the same, but I can't find a function called strcasecmp in that header
0
Agent_I it's probably because you didn't put an int before it