方法、数据转换

来源:互联网 发布:mac自定义iphone6铃声 编辑:程序博客网 时间:2024/06/05 10:58

Integer,Float,Double,Long,Byte,Short提供了特殊的方法能够将字符串类型的对象直接转换为对应的int,float,double,long,byte,short类型的数据 ,如:

Integer.parseInt("233");

Float.parseFloat("23.2423");

Double.parseDouble("232.3749943743");

Long.parseLong("98327236823"); 

String类方法:

int lastIndexOf(int ch);返回最后一次出现的指定字符在此字符串中的索引。

int lastIndexOf(int ch, formIndex);从指定的索引处开始进行后向搜索,返回最后一次出现的指定字符在此字符串中的索引。

原创粉丝点击