当前位置: 代码迷 >> Eclipse >> java获取字符串中的数值 可能想要的字符串
  详细解决方案

java获取字符串中的数值 可能想要的字符串

热度:189   发布时间:2016-04-22 23:51:10.0
java获取字符串中的数值 或者想要的字符串
[No=1001, Name=狱领导, NameOfPath=, ParentNo=100, TreeNo=, Leader=, Tel=, Idx=5, IsDir=1, FK_DeptType=02]
这样的字符串怎么只获取1001    求实例。。。  麻烦简单写下  谢谢
------解决思路----------------------
String  s="[No=1001, Name=狱领导, NameOfPath=, ParentNo=100, TreeNo=, Leader=, Tel=, Idx=5, IsDir=1, FK_DeptType=02]";
Matcher m= Pattern.compile("\\s(.*?)=(.*?)(,
------解决思路----------------------
\\])").matcher(s);
while(m.find()){
System.out.println(m.group(1)+"-------->"+m.group(2));
}
  相关解决方案