code: public static int splitToPairs(
          String str,
          List<WikiParameter> list,
          String delimiter,
          String end,
          char escapeChar)
      {
          if (str == null) {
              return 0;
          }
          char[] array = str.toCharArray();
          if (delimiter == null) {
              delimiter = " ";
          }
          char[] delimiterArray = delimiter.toCharArray();
          char[] endArray = end != null ? end.toCharArray() : new char[0];
          StringBuffer buf = new StringBuffer();
          int i = 0;
          boolean[] trim = {false};
          for (; i < array.length; ) {
              String key = null;
              String value = null;
              i = removeSpaces(array, i, buf);
              if (i >= array.length) {
                  break;
              }
              int prev = i;
              i = skipSequence(array, i, delimiterArray);
              if (i >= array.length) {
                  break;
              }
              if (i > prev) {
                  i = removeSpaces(array, i, buf);
                  if (i >= array.length) {
                      break;
                  }
              }
              // if provided ending sequence is found, we stop parsing
              if (end != null && matchesSequence(array, i, endArray)) {
                  break;
              }
  
              i = getNextToken(array, i, delimiterArray, buf, trim, escapeChar);
              key = buf.toString().trim();
  
              i = removeSpaces(array, i, buf);
              if (buf.indexOf("=") >= 0) {
                  i = getNextToken(
                      array,
                      i,
                      delimiterArray,
                      buf,
                      trim,
                      escapeChar);
                  value = buf.toString();
                  if (trim[0]) {
                      value = value.trim();
                  }
              }
  
              WikiParameter entry = new WikiParameter(key, value);
              list.add(entry);
          }
  
          return i;
      }
docs: Splits the given string into a set of key-value pairs; all extracted
  values will be added to the given list
  
  @param str the string to split
  @param list to this list all extracted values will be added
  @param delimiter a delimiter for individual key/value pairs
  @param end the ending sequence, if null it's not taken into account
  @param escapeChar the escaping character
  @return the index where parser stopped