String Validation

Hello, im writting in C++, and i need to validate a string of text, i need to make sure it contains only alpha letters, 1 to 10, and a dash.

I'm trying to find how to do it, the first thing that come up to my mind was a str.find(str2) for each letters of the alphabet... buts thats like too long for a such common method!

Thank you for your help

Vincent
Call .c_str() on the string, and then cycle through each character (knowing the length) and call isalpha(), isdigit() etc from the <cctype> library. That should work.
Nice, thanks for the fast anwser!
find_first_not_of()
Topic archived. No new replies allowed.