private String escapeString(String src,int from,int to){
  if (has_escape(src,from,to) == false) {
    return src.substring(from,to);
  }
  int len=to - from;
  final StringBuilder buf=new StringBuilder(len);
  for (int i=from; i < to; i++) {
    char c=src.charAt(i);
    if (c == '\\') {
      int c2=src.charAt(i + 1);
switch (c2) {
case '\'':
case '\"':
        continue;
case '\r':
      if (src.charAt(i + 2) == '\n') {
        i++;
      }
case '\n':
    i++;
  continue;
case '\\':
c='\\';
++i;
break;
case 'u':
{
int thisChar=0;
int y, digit;
for (y=i + 2; y < i + 6 && y < to + 1; y++) {
digit=Character.digit(src.charAt(y),16);
if (digit == -1) break;
thisChar=(thisChar << 4) + digit;
}
if (y != i + 6 || Character.isDefined((char)thisChar) == false) {
c=src.charAt(++i);
}
 else {
c=(char)thisChar;
i+=5;
}
break;
}
default :
{
if (PASS_ESCAPES_TO_BACKEND) {
c=src.charAt(++i);
break;
}
switch (c2) {
case 'b':
c='\b';
++i;
break;
case 'f':
c='\f';
++i;
break;
case 'n':
c='\n';
++i;
break;
case 'r':
c='\r';
++i;
break;
case 't':
c='\t';
++i;
break;
case 'v':
c=0xb;
++i;
break;
case 'x':
{
int d1, d2;
if (i + 4 > to || (d1=Character.digit(src.charAt(i + 2),16)) == -1 || (d2=Character.digit(src.charAt(i + 3),16)) == -1) {
++i;
c='x';
}
 else {
i+=3;
c=(char)((d1 << 4) + d2);
}
break;
}
default :
c=src.charAt(++i);
break;
}
}
}
}
buf.append(c);
}
return buf.toString();
}

private String escapeString ( String src , int from , int to ) { if ( has_escape ( src , from , to ) == false ) { return src . substring ( from , to ) ; } int len = to - from ; final StringBuilder buf = new StringBuilder ( len ) ; for ( int i = from ; i < to ; i ++ ) { char c = src . charAt ( i ) ; if ( c == '\\' ) { int c2 = src . charAt ( i + 1 ) ; switch ( c2 ) { case '\'' : case '\"' : continue ; case '\r' : if ( src . charAt ( i + 2 ) == '\n' ) { i ++ ; } case '\n' : i ++ ; continue ; case '\\' : c = '\\' ; ++ i ; break ; case 'u' : { int thisChar = 0 ; int y , digit ; for ( y = i + 2 ; y < i + 6 && y < to + 1 ; y ++ ) { digit = Character . digit ( src . charAt ( y ) , 16 ) ; if ( digit == - 1 ) break ; thisChar = ( thisChar << 4 ) + digit ; } if ( y != i + 6 || Character . isDefined ( ( char ) thisChar ) == false ) { c = src . charAt ( ++ i ) ; } else { c = ( char ) thisChar ; i += 5 ; } break ; } default : { if ( PASS_ESCAPES_TO_BACKEND ) { c = src . charAt ( ++ i ) ; break ; } switch ( c2 ) { case 'b' : c = '\b' ; ++ i ; break ; case 'f' : c = '\f' ; ++ i ; break ; case 'n' : c = '\n' ; ++ i ; break ; case 'r' : c = '\r' ; ++ i ; break ; case 't' : c = '\t' ; ++ i ; break ; case 'v' : c = 0xb ; ++ i ; break ; case 'x' : { int d1 , d2 ; if ( i + 4 > to || ( d1 = Character . digit ( src . charAt ( i + 2 ) , 16 ) ) == - 1 || ( d2 = Character . digit ( src . charAt ( i + 3 ) , 16 ) ) == - 1 ) { ++ i ; c = 'x' ; } else { i += 3 ; c = ( char ) ( ( d1 << 4 ) + d2 ) ; } break ; } default : c = src . charAt ( ++ i ) ; break ; } } } } buf . append ( c ) ; } return buf . toString ( ) ; }
copies a string from index < from > to < to > , interpreting escape characters
