Java Program To Remove Junk Or Special Characters In A String
public class JunkCharInString {
public static void main(String[] args) {
String s = "<>?#$^&*() latin string 01223455"; // Consider One String With Junks
s=s.replaceAll("[^a-zA-Z0-9 ]", ""); // This is regular expression -->
// Explaining that other than this characters(a-z,A-Z,0-9 and Space) , Replace with the
// Empty String.
System.out.println(s);
}
}
Output:
==========
latin string 01223455
Comments
Post a Comment