0
C++ : how to find a space(" ") in a string?
Hi there. I'm trying to compare each elements of a string to a space character in order to check if there's a gap (or space). I am doing this by using for loop. The error has been mentioned inside this minimal code: https://code.sololearn.com/cWLV1Y10AdjA/?ref=app Your help will be meaningful to me. So, thanks in advance EDIT: both answers down below are correct, and they explain what needs to be explained. Problem solved :) thank you very much!!!
2 Answers
+ 5
A lazy way is: if(your_char<33)
This works, because all the whitespace characters of the ascii table are assembled down there.