public static boolean quoteIfNeeded(Appendable buf,String s,String delim){
  for (int i=0; i < s.length(); i++) {
    char c=s.charAt(i);
    if (delim.indexOf(c) >= 0) {
      quote(buf,s);
      return true;
    }
  }
  try {
    buf.append(s);
    return false;
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}

public static boolean quoteIfNeeded ( Appendable buf , String s , String delim ) { for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; if ( delim . indexOf ( c ) >= 0 ) { quote ( buf , s ) ; return true ; } } try { buf . append ( s ) ; return false ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } }
quote a string into a stringbuffer only if needed . quotes are forced if any delim characters are present .
