I am trying to match a string to see if it follows a given pattern. I have seen this example in my Orielly books but do not understand the logic. Here is the a small snippet of example code:
const string digits("0123456789");
const string float_digit = digits + '.' + digits;
string test_string
The object is to determine if the test_string is a digit or a float_digit. If this is the case what would be a good way. Do you try to compare the test_string to the digit string (using the compare function) or do you have to use an loop to test each element in the test_string to see if it is a digit? What is the best or easiest way to do this?