Two Laptop Bag
The moose likes Beginning Java and the fly likes problem  with multiple character checking Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "problem  with multiple character checking" Watch "problem  with multiple character checking" New topic

problem with multiple character checking

vicneswaran boi

Joined: Sep 06, 2004
Posts: 13
if( (!mHp1.equals(""))&((mHp1.length() !=8)||(mHp1.charAt(0) !='9'+!='8'))) {
errorMsg += "<LI>Please check the handphone.";

)||(mHp1.charAt(0) !='9'+!='8'))) {

here how we can check the initial charectors 9 or 8. we need to identify the charectors using the charAt(0), is the above way to do this??? it is working for one digit example for 9 we can just check for 9,,but how to do it for multiple numbers???

Thanks for the help
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Consider regular expressions - have a look at the java.util.regex package.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63844

Moving to Java in General (beginner)

[Asking smart questions] [About Bear] [Books by Bear]
Joel McNary

Joined: Aug 20, 2001
Posts: 1824


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
I agree. Here's the link:
subject: problem with multiple character checking
It's not a secret anymore!