• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Space checking in a String  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think this is in the wrong group, but String.indexOf is your answer
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i would use regular expressions to check valid email addresses.
regexlib.com has good regex
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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 ]
 
ranger
Sheriff
Posts: 17314
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Brian"-
Welcome to the JavaRanch! Please adjust your displayed name to meet the

JavaRanch Naming Policy.

You can change it

here.

Thanks! and welcome to the JavaRanch!

Mark
 
Mark Spritzler
ranger
Sheriff
Posts: 17314
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Java Green"-
You have been asked 7 times already to adjust your displayed name to meet the

JavaRanch Naming Policy.

Mark
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!