Here is a base-10 checker that allows for ,'s and -'s (but doesn't check for placement). You can easily extend it to check for proper placement of special characters (,'s, and -'s) as well as other base numbers and floating point numbers.
// function to check for base-10 digits only
bool is_digit_base10(const CString& str)
{
static CString allowedChars = _T("0123456789,-");
const unsigned int length = str.GetLength();
for (unsigned int i = 0; i < length; ++i)
{
char buffer[2] = {0};
buffer[0] = str[i];
if (-1 == allowedChars.FindOneOf(buffer))
{
return false;
}
}
return true;
}
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac