Here you can find the source of parseString(String in, String token)
Parameter | Description |
---|---|
in | non-null string |
token | token to break - if null use \n |
public static String[] parseString(String in, String token)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { /**//from w ww. j a v a 2s . co m * Utility method to test equality on two possibly null objects * @param in non-null string * @param token token to break - if null use \n * @return non-null */ public static String[] parseString(String in, String token) { if (token == null) token = "\n"; StringTokenizer st = new StringTokenizer(in, token); String[] ret = new String[st.countTokens()]; int i = 0; while (st.hasMoreTokens()) ret[i++] = st.nextToken(); return (ret); } }