天天看點

Java用lastIndexOf和subString截取字元串

public static void main(String[] args) {
        String s = "/app/server/monitor/reportForms/查詢報表測試-彈灰-20210728.txt";
        int x = s.lastIndexOf("/");
        s = s.substring(x+1);
        System.out.println(s);
    }
           
Java用lastIndexOf和subString截取字元串