public static String removeBackslashEscapes(final String s){
  final StringBuilder sb=new StringBuilder();
  for (int k=0; k < s.length(); k++) {
    final char c=s.charAt(k);
    if (c == '\\') {
      if (++k == s.length()) {
        break;
      }
      final char d=s.charAt(k);
switch (d) {
case 'n':
        sb.append('\n');
      break;
case 'r':
    sb.append('\r');
  break;
case 't':
sb.append('\t');
break;
default :
sb.append(d);
break;
}
}
 else if (c == '#') {
break;
}
 else {
sb.append(c);
}
}
return sb.toString();
}

public static String removeBackslashEscapes ( final String s ) { final StringBuilder sb = new StringBuilder ( ) ; for ( int k = 0 ; k < s . length ( ) ; k ++ ) { final char c = s . charAt ( k ) ; if ( c == '\\' ) { if ( ++ k == s . length ( ) ) { break ; } final char d = s . charAt ( k ) ; switch ( d ) { case 'n' : sb . append ( '\n' ) ; break ; case 'r' : sb . append ( '\r' ) ; break ; case 't' : sb . append ( '\t' ) ; break ; default : sb . append ( d ) ; break ; } } else if ( c == '#' ) { break ; } else { sb . append ( c ) ; } } return sb . toString ( ) ; }
remove backslash escape sequences from a string .
