Here you can find the source of tokenizeOnWhitespace(String input)
public static String[] tokenizeOnWhitespace(String input)
//package com.java2s; // This package is part of the Spiralcraft project and is licensed under import java.util.ArrayList; public class Main { public static String[] tokenizeOnWhitespace(String input) { ArrayList<String> out = new ArrayList<String>(); int mark = -1; for (int i = 0; i < input.length(); i++) { if (Character.isWhitespace(input.charAt(i))) { if (i - mark > 1) { out.add(input.substring(mark + 1, i)); }//from w w w . j av a 2 s . c o m mark = i; } } if (input.length() - mark > 1) { out.add(input.substring(mark + 1, input.length())); } return out.toArray(new String[out.size()]); } }