We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,763 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

String validation

Hi all,
How could we validate that given string should only contains alphabetic characters,
pls share some ideas,
thanks in advance

3
Contributors
3
Replies
50 Minutes
Discussion Span
9 Months Ago
Last Updated
4
Views
Question
Answered
anand01
Posting Whiz in Training
288 posts since Aug 2010
Reputation Points: 12
Solved Threads: 22
Skill Endorsements: 0
  1. use the String matches(Regex) method with a regular expression for whatever you consider to be a letter in whatever languages you need to support.
  2. check each char in the String one at a time using Character's isLetter(char) method which knows about non-english characters.
JamesCherrill
... trying to help
Moderator
8,507 posts since Apr 2008
Reputation Points: 2,583
Solved Threads: 1,454
Skill Endorsements: 29

check the regex Pattern class and experiment with the constructs and matches method

zeroliken
Nearly a Posting Virtuoso
1,346 posts since Nov 2011
Reputation Points: 214
Solved Threads: 205
Skill Endorsements: 13

thanks for the replies

anand01
Posting Whiz in Training
288 posts since Aug 2010
Reputation Points: 12
Solved Threads: 22
Skill Endorsements: 0
Question Answered as of 9 Months Ago by zeroliken and JamesCherrill

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0629 seconds using 2.69MB