谁能告诉我如何将snake_case中的字符串转换为:
camel_case转换为camelCase中的字符串,如下所示:
camelCase在Java中?
提前谢谢你。
发布于 2015-12-12 01:36:08
这并不美观,但它是有效的:
String phrase = "camel_case";
String[] words = phrase.split("_");
String newPhrase = words[0];
for(int i=1; i<words.length; i++){
newPhrase += words[i].substring(0,1).toUpperCase() + words[i].substring(1);
}https://stackoverflow.com/questions/34228942
复制相似问题