Text literals are written using double quote characters. Internally all text is stored as Unicode. As GraRLS source files can be written in Unicode any character can be written into the text. If you are writing you source in ASCII you can still include any Unicode by specifying the Unicode value between backslashes. The Unicode must always be written in hexadecimal using upper case letter where appropriate. - there is no need for a leading zero. If more than one are adjacent you can just put a comma between them.
There are some special codes :-
It is best to avoid the carriage return and linefeed as the underlying operating system may not process them as expected.
A Text datum can have a Null value. This is not the same as the empty string "".
Text txt; . . . txt := "abcÄÅÖxyz"; txt := "abc\C4,C5,D6\xyz";
The concatenation operator is the same as the binary plus. The operator will yield a new string consisting of the first string followed by the second, "abcdef" :-
Text txt; . . . txt := "abc" + "def";
Single Character Extraction
To extract a single character from a string use the following syntax :-
charextract ::= expr [ expr ]
The first expr should yield a Text result; this is string from which a character will be extracted and return a Text value containing a single character. The second expr will be the index of the character counting from one. The following example will extract the 10th character, the 'i' and return a Text value "i" :-
text1 := "abcdefghijklmnopqrstuvwxyz"; text2 := text1;
To extract a sequence of characters from a string use the following syntax :-
seqextract ::= expr [ expr , expr ]
The new third expr will give the index of the last character to extract. If this parameter is Null then all the character to the end of the string will be extracted. The following example will extract the 10th to 12th characters, yielding "ijk" :-
text1 := "abcdefghijklmnopqrstuvwxyz"; text2 := text1[10, 12];
With Text values the text is compared character by character using the Unicode values. This is therefore case sensitive.