Oliver Bleckmann wrote in message ...
>how can i find out a string consists of letters/ numbers or other signs
#include <iostream>
#include <ostream>
#include <string>
#include <ccytpe>
int main(){
using std::cout; // for NG post
int Inum(0);
double Dnum(0);
std::string TestForNum("Hi 4 76.5num 42.7e-5");
cout<<"Test string = "<<TestForNum<<"."<<std::endl;
for(size_t i(0); i < TestForNum.size(); ++i){
cout<<"char at "<<i<<" is "<<TestForNum.at(i)<<", an ";
if( std::isdigit( TestForNum.at(i) ) ){
std::istringstream sis( TestForNum.substr( i ) );
sis >> Inum;
sis.clear();
sis.str( TestForNum.substr( i ) );
sis >> Dnum;
sis.clear();
cout<<"digit Inum="<<Inum
<<" Dnum="<<Dnum<<std::endl;
}
else{ cout<<"alpha"<<std::endl;}
}
return 0;
} // main()
>and especially how can i validate a date?
Call her up and ask her if it's still on! Duh!
--
Bob R
POVrookie
|