Java examples for XML:XML Encoding
remove ISO Control Chars from String
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { String input = "java2s.com"; System.out.println(removeISOControlChars(input)); }//from w w w. ja va 2 s . com public static String removeISOControlChars(String input) { char[] chars = input.toCharArray(); for (int i = 0; i < chars.length; i++) { char c = chars[i]; if (Character.isISOControl(c) && c != 0x09 && c != 0x0A && c != 0x0D) { chars[i] = ' '; } } return new String(chars); } }