Menu

scScript Strings

scScript supports two string formats, Short (quoted) strings and Long (bracketed) ones. The distinction is one of format and content, not length. Short strings must be delimited by matching single or double quotes. But they can trivially include quote characters dissimilar to the delimiting ones. For example:
MyVar ="John said 'he will be late'.";
or
MyVar = 'John said "he will be late".';

These short strings may also include inline escape sequences: \' or \" Insert non-delimiting quotes \\ Insert backslash character itself without escaping \n Insert newline \r Insert carriage return \t Insert tab \z Skip inline whitespace (space, tab, newline) \# No-op separator if a digit has to follow a numeric char spec \ddd or \[ddd] Insert char with decimal spec \xfff or \[xfff] Insert char with hex spec (typically 2 digits, leading 'x' or 'X') \okkk or \[okkk] Insert char with octal spec (typically 3 digits, leading 'o' or 'O')

Where numerical character specs can go all the way to 1114111 (0x0010FFFF) for Unicode (UTF-8).

So the above example could also be written as:
MyVar = "John said \"he will be late\".";

Long strings, in contrast, do not support any inline escape characters. They begin with |> with 0 to 8 intermediate - (dash) characters, such as |--->. The string must end with the exact mirror image delimiter sequence. So the above example can be: MyVar = |>John said "he will be late".<|; MyVar = |->John said "he will be late".<-|; MyVar = |-->John said "he will be late".<--|;
etc.

Importantly, long strings will ignore an initial and final newline character, if included. This is so source files can include long strings verbatim and without disturbing the formatting: MyVar = |----> This text includes |>, |->, and |-->! But it is represented verbatim, with just two intervening return characters! <----|;