最好是先查API doc :)static int parseInt(String s) Parses the string argument as a signed decimal integer. static int parseInt(String s, int radix) Parses the string argument as a signed integer in the radix specified by the second argument.
try { int i =Integer.parseInt("123"); } catch(Exception ex) {}呵呵,自我学习。
try{ int i =Integer.parseInt("123"); }catch(Exception e){}差不多10分就可以问到了:)
int i =Integer.parseInt("123");
我是来捡分的不过慢了一步: string str="12"; int s=Integer.parseInt(str);
有两个方法:1). int i = Integer.parseInt([String]); 或 i = Integer.parseInt([String],[int radix]);2). int i = Integer.valueOf(my_str).intValue(); 注: 字串转成 Double, Float, Long 的方法大同小异.
int Int =Integer.parseInt("这里写上要转的字符或变量"); 例:int Int =Integer.parseInt("789"); 或: String a="789"; int Int =Integer.parseInt(a); 如再有这种好事儿:QQ,12318872
int i =Integer.parseInt("123");
int i = new Integer("123").intValue();
这种问题都100分……
记得这段代码要捕捉异常
==============================================================
如上所言,并非完全正确,请从建议的角度、用怀疑的眼光批判地接收
Parses the string argument as a signed decimal integer.
static int parseInt(String s, int radix)
Parses the string argument as a signed integer in the radix specified by the second argument.
int i =Integer.parseInt("123");
} catch(Exception ex) {}呵呵,自我学习。
int i =Integer.parseInt("123");
}catch(Exception e){}差不多10分就可以问到了:)
string str="12";
int s=Integer.parseInt(str);
i = Integer.parseInt([String],[int radix]);2). int i = Integer.valueOf(my_str).intValue(); 注: 字串转成 Double, Float, Long 的方法大同小异.
例:int Int =Integer.parseInt("789");
或:
String a="789";
int Int =Integer.parseInt(a);
如再有这种好事儿:QQ,12318872
要是上不去的话!到http://www.21topic.com/asp/testkxnm/proxy.asp找个代理上去!