|
// *********************************************************
// 数値として正しいかどうか
// 戻り値 : true 正しい, false 正しく無い
// *********************************************************
BOOL LboxString::IsNumeric( void )
{
if ( !(this->IsNotDBCS()) ) {
return false;
}
if ( !(this->IsGroup( "01234567890.-" )) ) {
return false;
}
int i,nLen;
int nPeriod,nMinus;
nPeriod = nMinus = 0;
nLen = lstrlen( this->szLboxString );
for( i = 0; i < nLen; i++ ) {
if ( (*((this->szLboxString)+i)) == '.' ) {
nPeriod++;
}
if ( (*((this->szLboxString)+i)) == '-' ) {
nMinus++;
}
}
if ( nPeriod > 1 ) {
return false;
}
if ( nMinus > 1 ) {
return false;
}
if ( nMinus == 1 ) {
if ( (*(this->szLboxString)) != '-' ) {
return false;
}
}
return true;
}
| |