File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes How do i check for special characters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How do i check for special characters " Watch "How do i check for special characters " New topic
Author

How do i check for special characters

Anil Verghese
Ranch Hand

Joined: Oct 11, 2006
Posts: 155
Hi,

How do i check whether a string has special characters or not


Anil
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36453
    
  15
More of a beginners' question.
What do you mean by special characters?
Suggest you split the String into a char[] array and use the methods of the Character class on the individual chars.
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
The character-by-character approach will work.

An alternative would be to use a regular expression, via java.util.regex.Pattern. If you look up the API doc for Pattern, you will see that there are a wide variety of character classes on which you can match.


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do i check for special characters
 
Similar Threads
Range of Special Character
regex question
HQL + LIKE + _
How to check whether the input string contains numbers,comma,colon
Passing the JSTL variable (with special characters) to JavaScript function?