第6章-字符串内置类与包.pptVIP

  • 3
  • 0
  • 约 25页
  • 2017-06-09 发布于湖北
  • 举报
* 示例:使用String的方法 public class TestString { public static void main(String[] args) { String text = Hello Wish; int len = text.length(); char ch = text.charAt(6); int pos = text.indexOf(s); String sub = text.substring(0,5); String upper = text.toUpperCase(); String lower = text.toLowerCase(); System.out.println(原字符串是: + text ); System.out.println(字符串长度为: + len ); System.out.println(索引为6的字符是: + ch ); System.out.println(字符s的索引位置是: + pos ); System.out.println(索引从0到5的子串为: + sub ); System.out.println(大写字符串为: + upper ); System.out.pri

文档评论(0)

1亿VIP精品文档

相关文档