public static String escapeWhitespace(String s, boolean escapeSpaces) {StringBuilder buf = new StringBuilder();for (char c : s.toCharArray()) {if ( c==' ' && escapeSpaces ) buf.append('\u00B7');else if ( c=='\t' ) buf.append("\\t");else if ( c=='\n' ) buf.append("\\n");else if ( c=='\r' ) buf.append("\\r");else buf.append(c);}return buf.toString();}
public static string EscapeWhitespace(string s, bool escapeSpaces){StringBuilder buf = new StringBuilder();foreach (char c in s.ToCharArray()){if (c == ' ' && escapeSpaces){buf.Append('\u00B7');}else{if (c == '\t'){buf.Append("\\t");}else{if (c == '\n'){buf.Append("\\n");}else{if (c == '\r'){buf.Append("\\r");}else{buf.Append(c);}}}}}return buf.ToString();}