java中截取字符串中的數字方法有很多,例如用正則表達式。試壹試下面的演示程序吧。
public?class?SplitTest{
public?static?void?main(String[]?args)
{
String?input?=?"jdiwo3495jis90.5jsie4dss56djiw9";
String?regex?=?"\\d+(\\.\\d+)?";
Pattern?pattern?=?Pattern.compile(regex);
Matcher?matcher?=?pattern.matcher(input);
while(matcher.find())
{
System.out.println(matcher.group());
}
}
}