Friday, 7 March 2014

Railo: small new feature I didn't catch making it into the language

G'day:
This is a minor but handy feature in Railo 4.2 that Micha just gave me a heads-up on. One can treat a string as an array:

s = "G'day world";
for (i=1; i <= s.length(); i++){
    writeOutput(s[i]);
}
writeOutput("<hr>");

charAfterApostrophe = s[find("'", s)+1];
writeOutput("charAfterApostrophe: #charAfterApostrophe#");

Output:

G'day world

charAfterApostrophe: d


Not very exciting, but makes sense, and saves a call to mid() if needing to extract characters from the string.

--
Adam