随笔-9  评论-168  文章-266  trackbacks-0

 如何将字串 String 转换成整数 int?
int i = Integer.valueOf(my_str).intValue();

int i=Integer.parseInt(str);

如何将字串 String 转换成Integer ?
Integer integer=Integer.valueOf(str);

如何将整数 int 转换成字串 String ?
1.) String s = String.valueOf(i);
 
2.) String s = Integer.toString(i);
 
3.) String s = "" + i;

如何将整数 int 转换成Integer ?
Integer integer=new Integer(i);

如何将Integer 转换成字串 String ?
Integer integer=String

如何将Integer 转换成 int ?
int num=Integer.intValue();

如何将String转换成  BigDecimal  ?
 BigDecimal d_id = new BigDecimal(str);


如何将 String 转换成 char ?
char[] ca="123".toCharArray();

如何将char转换成String?
String s=ca.toString();      //任何类型都可以采用toString()转换成String类型

//-----------------日期-------------------------

Calendar calendar=Calendar.getInstance();
  int year=calendar.get(Calendar.YEAR);
  int month=calendar.get(Calendar.MONTH)+1;
  int day=calendar.get(Calendar.DATE);

获取今天的日期字符串
String today=java.text.DateFormat.getDateInstance().format(new java.util.Date());
获取今天的日期
new java.sql.Date(System.currentTimeMillis())

posted on 2008-09-09 14:18 紫蝶∏飛揚↗ 阅读(4400) 评论(1)  编辑  收藏 所属分类: JSFSpringStruts1/2Hibernate重点数据转换

评论:
# Internet Marketing 2009-05-18 12:51 | Internet Marketing
Hi all. The great art of giving consists in this: the gift should cost very little and yet be greatly coveted, so that it may be the more highly appreciated.
I am from Portugal and also now'm speaking English, give true I wrote the following sentence: "Com tips on how to do keyword research for search engine optimization to help ensure your site ranks well in search engines like google.Alexa rank and page rank provided by alexa."

With love 8-), Red.  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航: