Here you can find the source of sanitizeToLineFeed(CharSequence string)
public static String sanitizeToLineFeed(CharSequence string)
//package com.java2s; //License from project: Apache License public class Main { public static String sanitizeToLineFeed(CharSequence string) { StringBuilder sb = new StringBuilder(); for (int i = 0, len = string.length(); i < len; i++) { char c = string.charAt(i); boolean legal = c == '\u0009' || c == '\n' || (c >= '\u0020' && c <= '\uD7FF') || (c >= '\uE000' && c <= '\uFFFD'); if (legal) { sb.append(c);/*from w w w . j av a 2s . c o m*/ } } return sb.toString(); } }