Thread: Only Numbers
View Single Post
loiraolhosazul
Member
Join Date: May 2020
Old 02-20-2021 , 21:51   Re: Only Numbers
Reply With Quote #6

Or:

PHP Code:
stock bool:xValidNumber(const xStr[])
{
    new const 
xNumbers[][] =
    {
        
"0""1""2""3""4""5""6""7""8""9"
    
}
    
    new 
xLen strlen(xStr)
    new 
iaxValids
    
    
for(0xLeni++)
    {
        for(
0sizeof(xNumbers); a++)
        {
            if(
xStr[i] == xNumbers[a][0])
            {
                
xValids ++
                break
            }
        }
    }
    
    if (
xValids != xLen)
        return 
false
    
    
return true

loiraolhosazul is offline