All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.enilu.common.code.Utils Maven / Gradle / Ivy

package cn.enilu.common.code;

import org.nutz.lang.Strings;

/**
 * 工具类
*

Copyright by easecredit.com
* 作者: zhangtao
* 创建日期: 16-7-27
*/ public class Utils { /** * 将以“_”分割的单词转换为首字母小写驼峰格式 * @param src * @return */ public static String LOWER_CAMEL(String src){ src = src.toLowerCase(); StringBuilder result = new StringBuilder(); for(String sitem:src.split("_")){ if(result.toString().length()==0){ result.append(sitem); }else{ result.append(Strings.upperFirst(sitem)); } } return result.toString(); } /** * 以“_”分割的单词转换为首字母大写驼峰格式 * @param src * @return */ public static String UPPER_CAMEL(String src){ src = src.toLowerCase(); StringBuilder result = new StringBuilder(); for(String sitem:src.split("_")){ if(result.toString().length()==0){ result.append(Strings.upperFirst(sitem)); }else{ result.append(Strings.upperFirst(sitem)); } } return result.toString(); } public static void main(String[] args){ System.out.println(UPPER_CAMEL("AAAA_BBBB")); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy