c++ char comparison to see if a string is fits our needs -
i want work if chars of string variable tablolar
not contain char small letters between a-z
, ','
. suggest?
if string tablolar is;
"tablo"->it ok
"tablo,tablobir,tabloiki,tablouc"->it ok
"ta"->it ok
but if is;
"tablo2"->not ok
"ta546465"->not ok
"tablo"->not ok
"tablo,234,tablobir"->not ok
"tablo^%&!)=(,tablouc"-> not ok
what tried wrog;
for(int z=0;z<tablolar.size();z++){ if ((tablolar[z] == ',') || (tablolar[z] >= 'a' && tablolar[z] <= 'z')) {//do work here}}
tablolar.find_first_not_of("abcdefghijknmopqrstuvwxyz,")
return position of first invalid character, or std::string::npos
if string ok.