Text to Cap Alt

De DigiWiki.

A quite simple function that converts a string into the commonly used (and abused) format that consists of alternating the capitalization of the letters in a sentence.

Example: "What's your Second Life name?" would translate to "WhAt's yOuR SeCoNd lIfE NaMe?"

// Text2CapAlt(string text)
// by jadz0r Conover
// Sept. 04, 2006
 
string Text2CapAlt(string text) {
    integer x;
    string CapAltString;
    for (x = 0; x < llStringLength(text); x++) {
        if ((x % 2) == 0) {
            CapAltString = CapAltString + llToUpper(llGetSubString(text, x, x));
        } else {
            CapAltString = CapAltString + llToLower(llGetSubString(text, x, x));
        }
    }
 
    return CapAltString;
}
Outils personnels
  • Cette page a été consultée 563 fois.
donate
Google Ads