private String parseString(final String s,final char separator,final AtomicReference<String> value){
  final StringBuilder sb=new StringBuilder(s.length());
  int separatorIndex=-1;
  for (int i=0; i < s.length(); i++) {
    if (s.charAt(i) == separator && i + 1 < s.length() && s.charAt(i + 1) == separator) {
      sb.append(separator);
      i++;
      continue;
    }
    if (s.charAt(i) == separator) {
      separatorIndex=i;
      break;
    }
    sb.append(s.charAt(i));
  }
  value.set(sb.toString());
  if (separatorIndex != -1 && separatorIndex != s.length() - 1) {
    return s.substring(separatorIndex + 1);
  }
 else {
    return "";
  }
}

private String parseString ( final String s , final char separator , final AtomicReference < String > value ) { final StringBuilder sb = new StringBuilder ( s . length ( ) ) ; int separatorIndex = - 1 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( s . charAt ( i ) == separator && i + 1 < s . length ( ) && s . charAt ( i + 1 ) == separator ) { sb . append ( separator ) ; i ++ ; continue ; } if ( s . charAt ( i ) == separator ) { separatorIndex = i ; break ; } sb . append ( s . charAt ( i ) ) ; } value . set ( sb . toString ( ) ) ; if ( separatorIndex != - 1 && separatorIndex != s . length ( ) - 1 ) { return s . substring ( separatorIndex + 1 ) ; } else { return "" ; } }
this helper method breaks a string at the specified separator . the separator is escaped whenever it appears twice in a row .
