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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

easy string question 1

Status
Not open for further replies.

sparc20

Programmer
Mar 13, 2002
56
GB
does anyone remembers how to check if a string is characters only and not alphanumeric? im using j2se 1.4.2

thanx
 
What's about ws-characters like blank, tab, linefeed?
What about interpunctation, like dot, comma, semicolon?
What about internationalisation: äüÖ´e`e^e¢?

If you mean only A-Z and a-z, you may use patternmatching:
Code:
if (Pattern.matches ("[A-Za-z]+", str))
// or
if (Pattern.matches ("\p{Alpha}", str))

see: java.util.regex
Class Pattern
 
So - since it would not be fine to ask for an asterix, i don't ask for one.
Don't the users recognize asterixes as formularized 'thank you'? Don't they read the FAQs and nettiquettes?
 
its really a small asterix and someone could miss it easily
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top