code: public static void forEachToken(String string, String separator, Procedure<String> procedure)
      {
          for (StringTokenizer stringTokenizer = new StringTokenizer(string, separator); stringTokenizer.hasMoreTokens(); )
          {
              String token = stringTokenizer.nextToken();
              procedure.value(token);
          }
      }
docs: For each token in a string separated by the specified separator, execute the specified StringProcedure
  by calling the valueOfString method.