降低Google表格中的CamelCase

时间:2017-09-21 21:20:15

标签: google-sheets camelcasing

我想知道是否有人建议创建一个将text_with_spaces转换为较低驼峰情况的函数,如textWithSpaces

I've found a related question on SO,这有助于常规的驼峰案例,但我不确定如何将其降低到较低的CamelCase

2 个答案:

答案 0 :(得分:1)

假设它只是带空格的文本,

以下是使用REPLACESUBSTITUTE的另一个答案:

=REPLACE(SUBSTITUTE(PROPER(TRIM(A1))," ",""),1,1,LEFT(LOWER(TRIM(A1))))

使用REGEX:

=REGEXREPLACE(REGEXREPLACE(PROPER(A1),"\s*",""),"^(\w)",LEFT(LOWER(TRIM(A1))))

答案 1 :(得分:0)

如果要从text_with_spaces转到textWithSpaces,请尝试:

=left(A1)&mid(join("",arrayformula(proper(mid(split(A1,"_"),1,len(A1))))),2,len(A1))

如果要从text with spaces转到textWithSpaces,请尝试:

=left(A1)&mid(join("",arrayformula(proper(mid(split(A1," "),1,len(A1))))),2,len(A1))

LEFT
MID
JOIN
PROPER
SPLIT
LEN