
how to strip off unwanted characters from a string

Hi Friend,
Try this:
public class StripCharacters {
public String strip(String s) {
String st =" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
String result = "";
for ( int i = 0; i < s.length(); i++ ) {
if ( st.indexOf(s.charAt(i)) >= 0 )
result += s.charAt(i);
}
return result;
}
public static void main(String args[]) {
StripCharacters t = new StripCharacters();
System.out.println(t.strip("Hello **%$#)(World>"));
}
}
Thanks