【发布时间】:2013-03-07 19:59:06
【问题描述】:
我有单词列表,我必须删除括号内的字符串列表
day[1.0,264.0]
developers[1.0,264.0]
does[1.0,264.0]
employees[1.0,264.0]
ex[1.0,264.0]
experts[1.0,264.0]
fil[1.0,264.0]
from[1.0,264.0]
gr[1.0,264.0]
我应该得到
day
developers
does
.
.
.
.
这种方法正确吗?
String rep=day[1.0,264.0];
String replaced=rep.replace("[","]","1.0","2");
或
这种方法正确吗?
Pattern stopWords = Pattern.compile("\\b(?:i|[|]|1|2|3|...)\\b\\s*",Pattern.CASE_INSENSITIVE);
Matcher matcher = stopWords.matcher("I would like to do a nice novel about nature AND people");
String clean = matcher.replaceAll("");
【问题讨论】:
-
尝试自己了解哪种变体有效。