Register for your free account! | Forgot your password?

You last visited: Today at 14:24

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



IsNumeric()

Discussion on IsNumeric() within the Coding Releases forum part of the Coders Den category.

Closed Thread
 
Old   #1

 
.Sags Barney .!'s Avatar
 
elite*gold: 4
The Black Market: 142/0/0
Join Date: Nov 2010
Posts: 3,320
Received Thanks: 845
IsNumeric()

Es ist wirklich einfach ,aber vll braucht es jemand.
PHP Code:
BOOL IsNumericCHAR *txt )
{
    
BOOL STATUS    TRUE;
    
unsigned i    NULL;

    while( 
STATUS && strlentxt ) )
    {
        switch( 
txt[i] )
        {
            case 
'0':
            case 
'1':
            case 
'2':
            case 
'3':
            case 
'4':
            case 
'5':
            case 
'6':
            case 
'7':
            case 
'8':
            case 
'9':
            case 
'.'// maybe float?!
                // everything ok
            
break;
            default:
                
// w8, this shit aint numeric
                
STATUS FALSE;
        }
        
i++;
    }

    return 
STATUS;

.Sags Barney .! is offline  
Old 11/01/2011, 20:23   #2
 
Raz9r's Avatar
 
elite*gold: 297
Join Date: Dec 2010
Posts: 1,129
Received Thanks: 1,687
Credits: silentchris
100% C&P von WR-Cheats

Proof:
Raz9r is offline  
Thanks
1 User
Old 11/02/2011, 20:29   #3
 
Shadow992's Avatar
 
elite*gold: 77
Join Date: May 2008
Posts: 5,430
Received Thanks: 5,878
Quote:
Originally Posted by __underScore View Post
Credits: silentchris
100% C&P von WR-Cheats

Proof:
Noch dazu geht es Prozessor schonender und um einiges kürzer:

PHP Code:
BOOL IsNumericCHAR *txt 

    
BOOL STATUS    TRUE
    
unsigned i    NULL

    while( 
STATUS && strlentxt ) ) 
    { 
        if ((
txt[i]<'0' or txt[i]>'9') and txt[i]!='.')
           
STATUS=FALSE;
        
i++; 
    } 

    return 
STATUS

Shadow992 is offline  
Old 11/06/2011, 11:24   #4
 
Raz9r's Avatar
 
elite*gold: 297
Join Date: Dec 2010
Posts: 1,129
Received Thanks: 1,687
Quote:
Originally Posted by Shadow992 View Post
Noch dazu geht es Prozessor schonender und um einiges kürzer:

PHP Code:
BOOL IsNumericCHAR *txt 

    
BOOL STATUS    TRUE
    
unsigned i    NULL

    while( 
STATUS && strlentxt ) ) 
    { 
        if ((
txt[i]<'0' or txt[i]>'9') and txt[i]!='.')
           
STATUS=FALSE;
        
i++; 
    } 

    return 
STATUS

Code:
bool IsNumeric(char *szText)
{
for(; *szText != 0; szText++)
if((*szText < '0' || *szText > '9') && *szText != '.')
return false;
return true;
}
Raz9r is offline  
Thanks
1 User
Closed Thread




All times are GMT +1. The time now is 14:25.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.