UPDATE leads SET created = NOW() - INTERVAL 1 DAY WHERE ID = 4142432;
for (String retval: text.split("\\!\\.\\?"))
{
}
试图在拆分文本! 。 ?但是以上方法似乎不起作用,无法继续使用!
输出:
预处理生成了String text1 = "she said i know that she likes english food!";
,但预期结果是[she, said, i, know, that, she, likes, english, food!]
==>数组内容在索引[8]处不同,预期是:[she, said, i, know, that, she, likes, english, food, </s>]
,但是是:<food>
答案 0 :(得分:2)
text.split("\\!\\.\\?")
分裂成连续的!
,.
和?
,这不是您想要的
代替使用:
text.split("[!.?]")
输出: (输入:"This! is a lot? of words. separated by! punctuation?"
)
[This, is a lot, of words, separated by, punctuation]
答案 1 :(得分:0)
也许您应该尝试
String[] array = text1.split("!|\\.|\\?|\\s");
您需要添加| (或运算符),这将拆分!要么 。要么 ?或空格字符。 这应该给您[她说,我知道,她喜欢英语,食物]的结果