Java String Sanitize sanitizeToLineFeed(CharSequence string)

Here you can find the source of sanitizeToLineFeed(CharSequence string)

Description

sanitize To Line Feed

License

Apache License

Declaration

public static String sanitizeToLineFeed(CharSequence string) 

Method Source Code

//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();
    }
}

Related

  1. sanitizeSuiteName(String name)
  2. sanitizeTag(String s)
  3. sanitizeTextAsDomId(final String text)
  4. sanitizeTimezones(String s)
  5. sanitizeTokenString(final String tokenString)
  6. sanitizeToLong(String origMSISDN)
  7. sanitizeToString(String origMSISDN)
  8. sanitizeTypename(String name)
  9. sanitizeUnicode(String str)