code: public static void split(String s, char divider, String[] output) {
          int last = 0;
          int current = 0;
          int i;
          for (i = 0; i < s.length(); ++i) {
              if (s.charAt(i) == divider) {
                  output[current++] = s.substring(last,i);
                  last = i+1;
              }
          }
          output[current++] = s.substring(last,i);
          while (current < output.length) {
              output[current++] = "";
          }
      }
docs: Split a string into pieces based on the given divider character
  @param s the string to split
  @param divider the character on which to split.  Occurrences of
  this character are not included in the output
  @param output an array to receive the substrings between
  instances of divider.  It must be large enough on entry to
  accomodate all output.  Adjacent instances of the divider
  character will place empty strings into output.  Before
  returning, output is padded out with empty strings.