flink-learning-core/src/main/java/com/zhisheng/core/utils/StringUtils.java
/**
	 * Replaces control characters by their escape-coded version. For example,
	 * if the string contains a line break character ('\n'), this character will
	 * be replaced by the two characters backslash '\' and 'n'. As a consequence, the
	 * resulting string will not contain any more control characters.
	 *
	 * @param str The string in which to replace the control characters.
	 * @return The string with the replaced characters.
	 */
Replaces control characters by their escape-coded version.

@param str The string in which to replace the control characters.
@return The string with the replaced characters.
Replaces control characters by their escape - coded version . @param str The string in which to replace the control characters . @return The string with the replaced characters .
public static String showControlCharacters(String str) {
		int len = str.length();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < len; i += 1) {
			char c = str.charAt(i);
			switch (c) {
			case '\b':
				sb.append("\\b");
				break;
			case '\t':
				sb.append("\\t");
				break;
			case '\n':
				sb.append("\\n");
				break;
			case '\f':
				sb.append("\\f");
				break;
			case '\r':
				sb.append("\\r");
				break;
			default:
				sb.append(c);
			}
		}
		return sb.toString();
	}
public static String showControlCharacters ( String str ) { int len = str . length ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < len ; i += 1 ) { char c = str . charAt ( i ) ; switch ( c ) { case '\b' : sb . append ( "\\b" ) ; break ; case '\t' : sb . append ( "\\t" ) ; break ; case '\n' : sb . append ( "\\n" ) ; break ; case '\f' : sb . append ( "\\f" ) ; break ; case '\r' : sb . append ( "\\r" ) ; break ; default : sb . append ( c ) ; } } return sb . toString ( ) ; }
Replaces control characters by their escape-coded version.
Replaces control characters by their escape - coded version .