I'm looking for a way to check if a string is in uppercase.
and when there are no lowercase characters it may not write to a file.
so what i try reach is:
if the string = Test write it to a file cause it has a lowercase character.
if the string = TEST do not write it cause it has no lowercase characters.
Please correct me if i posted this in the wrond section, or my Title is misleading.
what is string ?
String Is std::string.
what i'm trying to do is filter out. the Uppercase words.
if my string = test then write it to file.
if my string = Test then write it to file.
if my string = TEst then write it to file.
if my string = TESt then write it to file.
but if my string = TEST then don't write it to the text file.
Your solution is a bad solution. You need not to test all characters of the string that they are all uppercase. It is enought to see that at least one character is lower case. I already showed you how to do it with the standard algorithm std::any_of. It is better to use standard algorithms instead of numerous loops that shall be examined that to understand what they are doing.