M
madhu
i have a string " 1; 200; 03; 4567; a; b; 7; 11; 9; 0.01; 0.11; 0,12;
140; 15; 16; 17;"
i want to check for alphabetical values from a to z .when i find them i
should give a mesage
incorrect input
std::vector<float> StringMap::getValueMatrix(const std::string& key)
{
std::string value = getValueString (key);
vector<float> matrix_value;
stringstream msg;
while(!value.empty()) {
string::size_type pos1 = value.find(";");
string::size_type pos2 = value.find(":");
//checks for ;, : in value
if(pos1<pos2)
{
if (!isdigit(value.substr(0, pos1).c_str()))
{
cout<<"Not a valid input";
break;
}
matrix_value.push_back (atof(value.substr(0, pos1).c_str()));
value.erase(0, pos1 + 1);
}
else
{
if (isdigit(value.substr(0, pos2).c_str()))
{
cout<<"Not a valid input";
break;
}
matrix_value.push_back (atof(value.substr(0, pos2).c_str()));
value.erase(0, pos2 + 1);
}
}
return matrix_value;
}
i tried using isdigit()
but i get an error
c:\_users\mbanda\veo_win32_workspace\tools\src\InteractionServer\VeoKit\StringMap.cxx(339):
error C2664: 'isdigit' : cannot convert parameter 1 from 'const char *'
to 'int'
please can anyone help me to know the correct method to do it
thanks in advance
madhu
140; 15; 16; 17;"
i want to check for alphabetical values from a to z .when i find them i
should give a mesage
incorrect input
std::vector<float> StringMap::getValueMatrix(const std::string& key)
{
std::string value = getValueString (key);
vector<float> matrix_value;
stringstream msg;
while(!value.empty()) {
string::size_type pos1 = value.find(";");
string::size_type pos2 = value.find(":");
//checks for ;, : in value
if(pos1<pos2)
{
if (!isdigit(value.substr(0, pos1).c_str()))
{
cout<<"Not a valid input";
break;
}
matrix_value.push_back (atof(value.substr(0, pos1).c_str()));
value.erase(0, pos1 + 1);
}
else
{
if (isdigit(value.substr(0, pos2).c_str()))
{
cout<<"Not a valid input";
break;
}
matrix_value.push_back (atof(value.substr(0, pos2).c_str()));
value.erase(0, pos2 + 1);
}
}
return matrix_value;
}
i tried using isdigit()
but i get an error
c:\_users\mbanda\veo_win32_workspace\tools\src\InteractionServer\VeoKit\StringMap.cxx(339):
error C2664: 'isdigit' : cannot convert parameter 1 from 'const char *'
to 'int'
please can anyone help me to know the correct method to do it
thanks in advance
madhu