驼峰,连接符,下划线命名等互相转换 CaseFormat.LOWER_CAME等

版权声明:本文为博主原创文章,转载请说明出处 https://blog.csdn.net/u010002184/article/details/85254704

1 jar:

guava-r05.jar

2

        String orderColumn = "orderColumn";
        //输入是LOWER_CAMEL,输出是LOWER_UNDERSCORE
        orderColumn = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, orderColumn);
        System.out.println(orderColumn);//order_column

        orderColumn = "orderColumn";
        //输入是LOWER_CAMEL,输出是UPPER_CAMEL
        orderColumn = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL,orderColumn);
        System.out.println(orderColumn);//OrderColumn

        orderColumn = "order_column";
        //输入是LOWER_UNDERSCORE,输出是LOWER_CAMEL
        orderColumn = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL,orderColumn);
        System.out.println(orderColumn);//orderColumn

end

猜你喜欢

转载自blog.csdn.net/u010002184/article/details/85254704