将空格分隔的字符串转换为字符串数组。
//package com.nowjava; public class Main {/* from nowjava - 时 代 Java*/ /** * Convert a space-separated string into an array of strings. * * @param msg String separated by spaces * @return String array of tokens in string. */ public static String[] GetTokens(String msg) { return msg.split("\\s+"); } }