Raised This Month: $ Target: $400
 0% 

Check if string is alphanumeric only


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
zeus
Senior Member
Join Date: Jul 2008
Old 04-23-2011 , 03:24   Check if string is alphanumeric only
Reply With Quote #1

Is there a better way to verify than this ?
PHP Code:
if( containiszName"`" ) != -|| containiszName"~" ) != -blabla 
zeus is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-23-2011 , 03:44   Re: Check if string is alphanumeric only
Reply With Quote #2

is_str_alpha( szName )

PHP Code:
is_str_alpha( const szString[] )
{
    new 
cChariPos
    
while( cChar szString[iPos++] )
    {
        if( !
isalpha(cChar) )
        {
            return 
false
        
}
    }
    return 
true

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 04-23-2011 at 03:50.
ConnorMcLeod is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:10.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode