• camel-name-utils 在驼峰风格跟下划线风格之间切换


    用处

    用来将字符串在驼峰风格跟下划线风格之间切换。

    对于一般人可能没用。对于写orm框架的人有点作用。

    样例:

    company_name -> companyName

    安装方式

    加入下面依赖到pom.xml
    <dependency>
      <groupId>org.crazycake</groupId>
      <artifactId>camel-name-utils</artifactId>
      <version>1.0.0-RELEASE</version>
    </dependency>

    使用方式

    @Test
    public void testCamel2underscore() {
            String underscoreName = CamelNameUtils.camel2underscore("AaaBbb");
            assertThat(underscoreName, is("aaa_bbb"));
    }
    
    @Test
    public void testUnderscore2camel() {
            String camelName = CamelNameUtils.underscore2camel("user_name");
            assertThat(camelName,is("userName"));
    }
    
    @Test
    public void testCapitalize() {
            String capitalName = CamelNameUtils.capitalize("student");
            assertThat(capitalName,is("Student"));
    }
    以上的介绍随时可能过期,最新版本号以项目主页为主
    https://github.com/alexxiyang/camel-name-utils

  • 相关阅读:
    threejs学习笔记01
    vue.nextTick()----(转)
    vue过滤器---123过滤成一二三
    太懒了,八百年没更新了。。。
    ie上 th td边框不显示
    简案快审----pdf.js使用总结
    201707问题记录
    echarts使用总结
    linux常见漏洞利用技术实践
    remote KG
  • 原文地址:https://www.cnblogs.com/mengfanrong/p/5182119.html
Copyright © 2020-2023  润新知