我有我要解析的字符串 newstr:
[( ?A = <http://www.semanticweb.org/vassilis/ontologies/2013/5/Test#Hello> ), ( ?A = <http://www.semanticweb.org/vassilis/ontologies/2013/5/Test#World> )]
使用下面显示的代码,我得到了这个结果:
[#Hello>, #World>]
我应该改变什么来获得:
Hello, World
代码:
List<String> strlist = new ArrayList<String>() ;
Pattern p = Pattern.compile("#([^>]+)>");
Matcher m = p.matcher(newstr);
while (m.find()) {
strto.add(m.group());
}
System.out.println(strtogams);
String[] strto2 = strto.toArray(new String[20]) ;