String的subString()和toUpCase()用法

来源:互联网 发布:算法竞赛入门经典 白书 编辑:程序博客网 时间:2024/06/09 21:51
/**
 * subString和toUpcase
 * @author Administrator
 *
 */
public class SubStringUsage {
public static void main(String[] args) {
String str$1 = "HelloWorld!";
System.out.println(str$1.substring(1));

//字符串值不变
System.out.println(str$1);

System.out.println(str$1.substring(1,2)); //Index example: HelloWorld  0 H 1 e 2

System.out.println(str$1.substring(1,2).toUpperCase());

}

}


输出结果:


elloWorld!
HelloWorld!
e
E

原创粉丝点击