test.java

来自「实例精华」· Java 代码 · 共 34 行

JAVA
34
字号
package STRING;

public class Test {
    public static void main(String[] args) {
        Test test = new Test();

        String a = "abcdef";
        String x = "ABCDE";
        String name = "administrator.com";
        System.out.println("String-a: "+a);
        System.out.println("String-x: "+x);
        System.out.println("String-name: "+name);
        //将一个串连接到别一个串的尾部
        String b = a.concat("ghijkl");
        System.out.println("concat: "+b);

        b = a.replace('b','@');
        System.out.println("replace: "+b);

        b = a.substring(3,6);
        System.out.println("substring: "+b);

        b = a.toUpperCase();
        System.out.println("toUpperCase: "+b);

        b = x.toLowerCase();
        System.out.println("toLowerCase: "+b);

        int c = a.indexOf('a');
        System.out.println("indexOf: "+c);

    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?