Find last occurrence of any valid character in a string C++
Posted on 2011-04-21
I have a C++ project and I read a line from a file, I'm using fgets but I can use anything. With that line I would like to find the last position, in the string, that contains a valid character or number, i.e. 0-9 or a-Z. I don't really what to create a string that holds all the numbers and characters to use as a compare I would like the most eligant was to find the last vaild character/number in the string so I can extract a variable size word from the string.