日期:2014-05-20 浏览次数:20696 次
String str = "speEd=2000MHz"; Pattern p = Pattern.compile("(?i).*?=(\\d*)"); Matcher m = p.matcher(str); m.find(); System.out.println(m.group(1));
------解决方案--------------------
String s = "speed=2000MHz1024"; String num = s.replaceAll("speed\\s*=\\s*(\\d+).*", "$1"); System.out.println(num);
------解决方案--------------------
Pattern p = Pattern.compile("\\d+");
Matcher m = p.matcher(arg0);
if(m.find())
String num = m.group(0);
这样不是取到数据了吗?
------解决方案--------------------
public String get() { String str = "speed=2000MHz"; return "2000"; }