Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Button handy
blanktrue
color#0052CC
nameSend Feedback
linkhttps://docs.google.com/forms/d/e/1FAIpQLScmToBe3vynAlb5fdKwCGxYqnTbDc66sIBgeecG2BuFDuHc7g/viewform?entry.2002826954=Camel+case+function+-+1222738204
widthauto

Excerpt
hiddentrue
namedescription

Function to convert a text string containing a single or multiple words into a camel case test string.

...

Code Block
function camelCase(string name) {
    string [] words = split(name, " ");
    string cc = toLower(words[0]);
    
    for(int x=1; x<size(words); x++) {
        string nextWord;
        for(int l=0; l<length(words[x]); l++) {
            if(l==0) {
                nextWord = toUpper(words[x][l]);
            } else {
                nextWord += words[x][l];
            }
        }
        cc += nextWord;
    }
    return cc;
}

return camelCase("I love using Power Scripts");

//returns iLoveUsingPowerScripts

We've encountered an issue exporting this macro. Please try exporting this page again later.