本站启用国内永久域名: www.LewenSky.cn,请大家使用新域名访问网站!
6月24

JSP之int和String互相转换的多种方法

| |

1 如何将字串 String 转换成整数 int?

A. 有两个方法:

1). int i = Integer.parseInt([String]); 或
i = Integer.parseInt([String],[int radix]);
2). int i = Integer.valueOf(my_str).intValue();

注: 字串转成 Double, Float, Long 的方法大同小异.

2 如何将整数 int 转换成字串 String ?

A. 有叁种方法:

1.) String s = String.valueOf(i);
2.) String s = Integer.toString(i);
3.) String s = "" + i;

注: Double, Float, Long 转成字串的方法大同小异. 



出处:赛迪网
转载时必须以链接形式注明出处及本声明!


最新日志 随机日志 综合排行
  • OFFICE 2010 VOL...
  • 格式工厂绿色版 V2.90
  • Password Invent...
  • VideoCacheView ...
  • 电脑店U盘启动盘制作工具 3....
  • 阿里旺旺AliIM2011_7...
  • 极点五笔十周年纪念版
  • PPTV网络电视3.1.1.0...
  • WinRAR注册方法
  • 紫光华宇拼音输入法 6.8.0...
  • Foobar2000 v1.0...
  • PPTV网络电视2.7.0.0...
  • Photoshop抠图专家:K...
  • Windows 7 / 200...
  • IconsExtract v1...
  • 紫光华宇拼音输入法 6.8.0...
  • Windows 7 Loade...
  • DLL Export View...
  • Office 2007 SP2...
  • 酷我音乐盒2010冬季版V5....
  • 安装软件时出现系统提示&quo...
  • XP与XP无线共享设置(笔记本...
  • ZineMaker目录模板大集...
  • 没有不可能 轻松实现PDG转P...
  • CString转char的方法...
  • [转]MSDN精简版、MSDN...
  • 将IE、FIREFOR (火狐...
  • VC多线程编程(转)
  • MyEclipse6.5下载地...
  • Diskeeper 2010 ...
  • Tags:
    阅读(2724) | 评论(0) | 引用(0)
    发表评论
    表情
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    打开HTML
    打开UBB
    打开表情
    隐藏
    记住我
    昵称   密码   游客无需密码
    网址   电邮   [注册]