Hi,
I am using some legacy swing application, and every time I use ctrl-v or ctrl-c, there is a strange control character generated (it looks like a square/rectangle) at the end of the string. I cannot paste this special character here while I can easily do it in Eclipse IDE. The problem is, if I replace \u007F with this special character, I cannot use replaceAll("[\u007F]","") to remove it from the string, while I can remove it if the string contains unicode representation such as
"first\u007F". I am wondering how I can remove it from string when it does not have unicode representation. Thanks.
public class ControlCharacterTest {
public static void main(String[] args){
char controlChar = '\u007F';
String cChar = new Character(controlChar).toString();
System.out.println("Control char == " + cChar);
String input = "first";
String newInput = input.replaceAll ("[\u007F]","");
System.out.println("newInput == " + newInput);
String newInput2 = input.replaceAll ("[\u0000-\u0020]","");
System.out.println("newInput2 == " + newInput2);
}
}
null
Message was edited by:
jack_wns
null