Using String Literals in the Expression Builder

String literals

Specifying string literals in expressions using C# or C++

Examples of using string literals in a Labels theme

String literals

String literals can be used in the Expression Builder dialog. String literals can be enclosed in matching single quotes (') or double quotes (").

String literals in expressions can use 32-bit Unicode escape sequences, for example '\U00000041' ('A'), as well as 16-bit ones, for example '\u0041'. NB \U and \u escape sequences cannot be used within C# or C++ 11 string literals.

The valid SIS escape sequences are:

\b backspace
\f form feed
\n line feed
\r carriage return
\t horizontal tab
\uXXXX UTF-16 unicode character where XXXX are 4 hexadecimal digits
\v vertical tab
\" double quote
\' single quote
\\ backslash

You can use either single quotes or double quotes for text, "'" and '\'' are equivalent, as are '"' and "\"".

Note: Entering an invalid escape sequence will cause the entire expression to be invalid.

Note: When using the Expression Builder numbers as strings that are cast to integer or absolute (decimal, float) values are not always treated as numeric. To ensure they are treated as numeric (especially when sorting) you should use the following casting methods:

Integers as strings - you can use Int(Val("123"))

Floats as strings - you can use Abs(Val("3.1415"))

Specifying String literals in expressions using C# or C++

String literals in expressions can be specified using C# or C++ 11 styles, for simpler embedding of backslashes and/or quote characters:

C# verbatim string literals

C++ 11 raw string literals

Examples of using String literals in a Labels theme

Example 1

Entering the string literal:

"Tree\\Shrub areas\r\n10\u0025"

would produce the following:

Example 2

Entering the string literal:

"\"Title of Text\r\nFirst Line of text\r\nLine of text\r\nLine of text\r\nFinal Line of text"

would produce the following:


Send comments on this topic.

Click to return to www.cadcorp.com

© Copyright 2000-2017 Computer Aided Development Corporation Limited (Cadcorp).