Here you can find the source of sanitize(final String s)
public static String sanitize(final String s)
//package com.java2s; // the Bio-Formats library, licensed according to Simplified BSD, as follows: public class Main { /** Removes unprintable characters from the given string. */ public static String sanitize(final String s) { if (s == null) return null; StringBuffer buf = new StringBuffer(s); for (int i = 0; i < buf.length(); i++) { final char c = buf.charAt(i); if (c != '\t' && c != '\n' && (c < ' ' || c > '~')) { buf = buf.deleteCharAt(i--); }//from ww w.j a va 2s . c o m } return buf.toString(); } }