This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Saving A Clean String

 
Jonathan Fleming
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I go about making sure that no bad or special characters are entered into a string?
Basically I'd like the string to be of ascii characters only or those that can be used in an image filename on the web.
Thanks
Jonathan :^)
 
Max Habibi
town drunk
( and author)
Sheriff
Posts: 4118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Jonathan,
If you're using java 1.4+, you can try

In English: "I'm going to describe a String: if my description matches this particular candidate String exactly, then return true, else false.
The description is this: I'd like any sequence of letters, numbers, or underscores, repeated one or more times. Then, I'd like a period. then, I'd like any sequence of letters, numbers, or underscores, repeated one or more times"
HTH,
M
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic