code: private StringBuilder appendQuotedString(String pattern, ParsePosition pos, StringBuilder appendTo,
              boolean escapingOn)
      {
  
          int start = pos.getIndex();
          char[] c = pattern.toCharArray();
          if (escapingOn && c[start] == QUOTE)
          {
              next(pos);
              return appendTo == null ? null : appendTo.append(QUOTE);
          }
          int lastHold = start;
          for (int i = pos.getIndex(); i < pattern.length(); i++)
          {
              if (escapingOn && pattern.substring(i).startsWith(ESCAPED_QUOTE))
              {
                  appendTo.append(c, lastHold, pos.getIndex() - lastHold).append(QUOTE);
                  pos.setIndex(i + ESCAPED_QUOTE.length());
                  lastHold = pos.getIndex();
                  continue;
              }
              switch (c[pos.getIndex()])
              {
              case QUOTE:
                  next(pos);
                  return appendTo == null ? null : appendTo.append(c, lastHold, pos.getIndex() - lastHold);
              default:
                  next(pos);
              }
          }
  
          throw new IllegalArgumentException("Unterminated quoted string at position " + start);
  
      }
docs: Consume a quoted string, adding it to <code>appendTo</code> if specified.
  
  @param pattern
  pattern to parse
  @param pos
  current parse position
  @param appendTo
  optional StringBuffer to append
  @param escapingOn
  whether to process escaped quotes
  @return <code>appendTo</code>