| 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: 32692
|
|
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.<br /> <br />#:^P
|
 |
 |
|
|
subject: How do i check for special characters
|
|
|