呵呵 简单的小问题呵
int intValue = Integer.parseInt("1024MB");
我想要的返回是1024啊 但是这个会报异常
怎么不能向c中的atoi这样变成1024呢
在java中这个改怎么办 怎样让他返回1024 有线程的函数吗
因为输入的字符串是位置的 但都是数字开头谢谢
int intValue = Integer.parseInt("1024MB");
我想要的返回是1024啊 但是这个会报异常
怎么不能向c中的atoi这样变成1024呢
在java中这个改怎么办 怎样让他返回1024 有线程的函数吗
因为输入的字符串是位置的 但都是数字开头谢谢
int intValue = Integer.parseInt("1024MB".replace("MB",""));
String b="";
int i=0;
while(true){
try{
b= b+Integer.parseInt("a[i]").toString;
} catch (Exception e) {
int intValue = Integer.parseInt(b);
return intValue;
}
}
String b="";
int i=0;
while(true){
try{
b= b+Integer.parseInt("a[i]").toString;
} catch (Exception e) {
int intValue = Integer.parseInt(b);
return intValue;
}
}
这个呢。
String b="";
int i=0;
while(true){
try{
b= b+Integer.parseInt("a[i]").toString;
i++;
} catch (Exception e) {
int intValue = Integer.parseInt(b);
return intValue;
}
}
int intValue = Integer.parseInt(b);
return intValue; 刚才居然忘了i++。。
System.out.println(Pattern.compile("\\D+").split("1232dsf")[0]);
System.out.println(Pattern.compile("\\D+").split("0123fmd")[0]);
System.out.println(Pattern.compile("\\D+").split("8883dsess")[0]);
}
1232
0123
8883
不是\d匹配数字么?
\\d不限数量匹配数字?
崇拜啊