我有這樣
String message = "This is the new message or something like that, OK";
一個字符串,我想把它分成數組
String[] dic = {"this", "is", "the", "new", "message", "or", "something", "like", "that", "OK"};
我用
message = message.split("\\s+");
的問題是,它包含了「中指出, 「不」,「就像我想要的。請教我如何解決它。由於
可能重複[分割字符串通過在Java中的標點符號和空格等正則表達式(http://stackoverflow.com/ questions/7384791/splitting-strings-through-regular-expressions-by-punctuation-and-whitespace-etc) – assylias