骆驼峰和下划线两种命名方式的互转

原创
2019/12/24 21:10
阅读数 138

import com.google.common.base.CaseFormat;

String s1 = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, "recordId");
    String s2 = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, "RecordId");
    String s3 = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "RECORD_ID");
    String s4 = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, "RECORD_ID");
    System.out.println(s1);
    System.out.println(s2);
    System.out.println(s3);
    System.out.println(s4);
展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部