-3
好吧,我已經編寫了將段落拆分成句子的代碼。下面是。但是現在我想用「split」這個詞分開句子。但是如何?.split()在循環?這可能嗎?
import java.util.*;
import java.util.regex.*;
public class sub {
public static void main(String[] args) {
String test ="As World War split II loomed after 1938, with the Japanese invasion split of China and the aggression of Nazi Germany, Roosevelt gave strong diplomatic split and financial support to China and the United Kingdom, while remaining split officially neutral";
String[] sHolder = test.split("[.,?]");
for (int i = 0; i < sHolder.length; i++){
sHolder [i] = sHolder[i].replaceAll("\\[a-z]", "");
}
}
不確定一個句子應該被分成','。你可以按空格分成單詞。 –
好吧,只要改變你的正則表達式。如果你想拆分''split'',那麼問題是什麼? – kamoroso94