package lianxii;
import java.util.Locale;
public class Change {
public static void main(String[] args) {
String name = "i";
Locale loc = Locale.getDefault();//可以去掉这步
System.out.println("转换前:" + name);
System.out.println("转换后:" + name.toLowerCase());
System.out.println("转换后:" + name.toLowerCase(loc));
System.out.println("转换后:" + name.toUpperCase(loc));
}
}
//结果:
//转换前:i
//转换后:i
//转换后:i
//转换后:I
import java.util.Locale;
public class Change {
public static void main(String[] args) {
String name = "i";
Locale loc = Locale.getDefault();//可以去掉这步
System.out.println("转换前:" + name);
System.out.println("转换后:" + name.toLowerCase());
System.out.println("转换后:" + name.toLowerCase(loc));
System.out.println("转换后:" + name.toUpperCase(loc));
}
}
//结果:
//转换前:i
//转换后:i
//转换后:i
//转换后:I