Java字符串转为驼峰格式

时间:2025-02-16 08:57:30
/*构造函数*/ public static String toCamelCase(String str, boolean capitalizeFirstLetter, char... delimiters) 其中:str为要转换的字符串;capitalizeFirstLetter表示是否首字母大写;delimiters指定连词符。 /*使用方法*/ CaseUtils.toCamelCase(null, false) = null CaseUtils.toCamelCase("", false, *) = "" CaseUtils.toCamelCase(*, false, null) = * CaseUtils.toCamelCase(*, true, new char[0]) = * CaseUtils.toCamelCase("", false, new char[]{'.'}) = "toCamelCase" CaseUtils.toCamelCase(" to @ Camel case", true, new char[]{'@'}) = "ToCamelCase" CaseUtils.toCamelCase(" @to @ Camel case", false, new char[]{'@'}) = "toCamelCase"