Java String toUpperCase() 和 toLowerCase() 方法
该方法使用默认语言环境的规则将此String中的所有字符转换为大写 toUpperCase()
该方法使用默认语言环境的规则将此字符串中的所有字符转换为小写。 toLowerCase()
示例
import java.lang.*;
public class StringDemo {
public static void main(String[] args) {
//将所有大写字母转换为小写字母
String str1 = "SELF LEARNING CENTER";
System.out.println("string value = " + str1.toLowerCase());
str1 = "TUTORIALS POINT";
System.out.println("string value = " + str1.toLowerCase());
//将所有小写字母转换为大写字母
String str2 = "This is nhooo";
System.out.println("string value = " + str2.toUpperCase());
str2 = "www.nhooo.com";
System.out.println("string value = " + str2.toUpperCase());
}
}输出结果string value = self learning centre string value = tutorials point string value = THIS IS nhooo string value = WWW.nhooo.COM
热门推荐
1 训练狗狗憋尿
2 狗狗追踪训练
3 狗狗训练要多少钱
5 深圳狗狗训练
6 训练狗狗唤回
7 狗狗叫怎么训练
8 狗狗训练班
10 狗狗社会化训练
11 狗狗叫回训练
12 广州狗狗训练学校
13 狗狗训练躺下
14 狗狗随行训练
15 训练狗狗巡回
16 狗狗要怎么训练
17 狗狗喂食训练
18 训练狗狗躺下