-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