Here you can find the source of sanitize(String s, boolean allowColorCodes)
public static String sanitize(String s, boolean allowColorCodes)
//package com.java2s; //License from project: Apache License public class Main { public static String sanitize(String s, boolean allowColorCodes) { // well-known client crash in FontRenderer while (s.endsWith("\u00a7")) s.substring(0, s.length() - 1); // strip minecraft and IRC codes if (!allowColorCodes) s = s.replace('\u00a7', ' ').replace((char) 0x03, ' ').replace((char) 0x02, ' ') .replace((char) 0x1D, ' ').replace((char) 0x1F, ' ').replace((char) 0x16, ' '); // nope//from w w w. j a v a 2 s .c om s = s.replace('\n', ' ').replace('\r', ' ').replace('\b', ' ').replace('\f', ' ').replace("\t", " "); return s; } }