Character Vector (String) Comments

General:A string is one of Glee's types. It is a vector of characters. This frame illustrates how you create strings and work with them.





Single Quote ( ' ' ) delimiters: Glee needs to distinguish string literals from variable names. For example ('Now'=>now). It does this with pairs of single or double quotes. If the literal contains the double quote ( "  ) character, you need to use the single quote ( ' ' ) form to express the literal.





Double Quote ( "  " ) delimiters: If the literal contains the single quote ( ' ) , you need to use the double quote ( " " ) form to express the literal.





Combinations: If your literal contains both ( " ) and ( ' ) characters you need to build it up by catenation. The comma ( , ) is Glee 's catenation operator (sometimes called concatenation).





$R/$r: Raw literals: The previous example, while common to other programming languages, is cumbersom. For large chunks of text which you cut and paste into your code, it's just plain impossible. Glee has a special $ escape sequence to facilitate introduction of large chunks of raw text. The text can contain any special characters and freely use the (") and (') which would otherwise be taken as delimiters. You prefix your raw text with a $R followed by your terminator string (xxx in this example). The terminator string can be a string of characters of any length that you know will not occur in the raw text. The terminator string is followed by the $r to close it off. You then append that exact terminator string to the raw text.

Here's what Glee does. It sees the $R and starts collecting terminator string characters until it sees the closing $r. It marks the beginning of the raw text. Glee then searches for the terminator string and stops when it finds it (the trailing xxx in the example). It closes off the raw text, drops the terminating string and delivers the text as the result. The example stores that result in "s" and then displays it.





: .