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.
Joined: Aug 05, 2002
i think this is in the wrong group, but String.indexOf is your answer
Joined: Mar 23, 2003
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!
Joined: Sep 07, 2004
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 ]