Removing special characters from String
Hi all,
I am trying to write a method or statement that will remove any special characters from a String before processing it further.
For example: "Hello my name isn't John" would be changed to "Hello my name isnt John".
I am then tokenizing the String and placing each char of each token into an ArrayList like so, (casting to Character first):
"HellomynameisntJohn"
I know I could ckeck each Character against a list of special characters like this:
if(Arraylist[i].equals(') || Arraylist[i].equals(!) || and on and on and on....)
then break without inserting the character into the Array. It seems like this is a very inefficient way to code this.
Isn't there some way to compare the ASCII code of each character and say something like:
if((ASCII_VALUE) of Arraylist[i] > someASCIIVal)
Then break without adding to Array.
"I hope that one day I will be able to answer someone elses questions!"
Bookmarks