String check
-
HI , How to check whether a string does not contain any data other that 'A' - 'Z' or '0' - '9' is there any API available
You could use
CString::SpanExcluding
if you're using MFC. Otherwise use thestrcspn
function.«_Superman_» I love work. It gives me something to do between weekends.
-
HI , How to check whether a string does not contain any data other that 'A' - 'Z' or '0' - '9' is there any API available
pandit84 wrote:
How to check whether a string does not contain any data other that 'A' - 'Z' or '0' - '9'
You can use
_istalnum
,_isalnum
function...bool IsValidAlNumStr( LPCTSTR lpctszStr )
{
while( *lpctszStr )
{
if( !_istalnum(*lpctszStr ))
return false;++lpctszStr;
}
return true;
}Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com