1 基本类型转换为字符串
int c = 10
String str = Integer.toString(c); 方法1
String str1 = String.valueof(c); 方法2
STring Str2 = c+ "";方法3
2 字符串转换成基本类型
String str = "8";
int d = Integer.parseInt(str);方法1
int e = Integer.valueof(str);方法2
3 时间规范化
Date d = new Date();
SimpleDateFormat sd = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");
String dateStr = sd.format(d); //使用 format() 方法将日期转换为指定格式的文本
Date date = df.parse(dateStr); // 使用 parse() 方法将文本转换为日期
4 日期

5 算术类 Math

网友评论