This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Is there a way to check for space inside a String value? I am validating email address in my application and need to make sure I have a some what valid email address.
Thanks
john guthrie
Ranch Hand
Joined: Aug 05, 2002
Posts: 124
posted
0
i think this is in the wrong group, but String.indexOf is your answer
Salman Khattak
Ranch Hand
Joined: Mar 23, 2003
Posts: 33
posted
0
i would use regular expressions to check valid email addresses. regexlib.com has good regex
SCJP Java 1.4 - 06/2003<br />Power corrupts and absolute power corrupts absolutely!
Java Green
Greenhorn
Joined: Sep 07, 2004
Posts: 7
posted
0
There is an implemetation provided in struts validator frame work to check whether it is email or not. There is an "isEmail()" method available in org.apache.commons.validator.GenericValidator class which is available in commons-validator.jar, can be downloadable from struts.apache.org
Is there a way to check for space inside a String value? I am validating email address in my application and need to make sure I have a some what valid email address
Assuming we are talking about addresses for SMTP, valid SMTP email addresses can have spaces in them.
Also the class InternetAddress packaged with JavaMail will validate an address as part of its constructor, unless you tell it otherwise. So if you are eventually using the address to send mail, then this is a perhaps a more sensible route than including extra 3rd party dependancies. [ November 23, 2004: Message edited by: Paul Sturrock ]