static public String backslashEscapeCDMString(String s, String toescape) {
    """
	Given a CDM string, insert backslashes
	before <toescape> characters.
    """
      if(toescape == null || toescape.length() == 0) return s;
      if(s == null || s.length() == 0) return s;
      StringBuilder buf = new StringBuilder();
      for(int i=0;i<s.length();i++) {
        int c = s.charAt(i);
        if(toescape.indexOf(c) >= 0) {
          buf.append('\\');
        }
        buf.append((char)c);
      }
      return buf.toString();
    }
static public String backslashEscapeCDMString(String s, String toescape)
    {
      if(toescape == null || toescape.length() == 0) return s;
      if(s == null || s.length() == 0) return s;
      StringBuilder buf = new StringBuilder();
      for(int i=0;i<s.length();i++) {
        int c = s.charAt(i);
        if(toescape.indexOf(c) >= 0) {
          buf.append('\\');
        }
        buf.append((char)c);
      }
      return buf.toString();
    }
static public String backslashEscapeCDMString ( String s , String toescape ) { if ( toescape == null || toescape . length ( ) == 0 ) return s ; if ( s == null || s . length ( ) == 0 ) return s ; StringBuilder buf = new StringBuilder ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { int c = s . charAt ( i ) ; if ( toescape . indexOf ( c ) >= 0 ) { buf . append ( ' ' ) ; } buf . append ( ( char ) c ) ; } return buf . toString ( ) ; }
Given a CDM string, insert backslashes
before <toescape> characters.
Given a CDM string insert backslashes before <toescape > characters .