當用java guava拆分器拆分時可以不打破單詞嗎?爪哇番石榴拆分器不打破這個詞
我有這樣的例子:
var String msg = "My name is Fabio and I have a dog";
Splitter.fixedLength(5).split(msg).forEach(item -> {
System.out.println(item);
});
會打印:
My na
me is
Fabi
o and
I ha
ve a
dog
但我想,他不食言
就像這樣:
My naME
is Fabio
and I have
a dog
布我沒有控制文本,我只想保留最後一個字的分數