【Java】+获取字符串首位和末位

    public static void main(String[] args) {
        String str = "[测试}";
        if (str.startsWith("[")) {
            System.out.println(String.format("首位:["));
        }
        if (str.endsWith("+")) {
            System.out.println(String.format("首位:}"));
        }
    }

原文地址:https://www.cnblogs.com/danhuai/p/12877486.html