Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

strspn A:Z 2

Status
Not open for further replies.

Niv3k

Programmer
Jul 11, 2001
350
US
I want to make sure that someone has typed at least one alpha character (a-z, A-Z) inside a textbox used on a form. Is there a way to use strspn with a range instead of "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"?

Or, alternately, is there a better method than that anyway?

Kevin
 
Yes

you can use regexps

if (ereg("[a-zA-Z]",$textfield)){
// textfield has at least one alpha
}
else{
// no alpha chars found
}
Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
Yay! Thanks, Ani.

(The real reason darth vader went bad... He never got over the trauma of his mom calling him "Ani")

Kevin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top