====== String Type ======
A [[wp>String_(computer_science)|string]] is a sequence of arbitrary characters.
===== GUI Editor =====
[{{ :editors:string_editor.png?nolink |Graphical representation of the string editor}}]
The string editor presents a text field where the string's characters can be typed directly.
===== EGO Script =====
==== Legacy ====
Strings are sequences of any characters enclosed in double quotes (''"''):
"Amazon"
"North"
"This is an example of string"
"landscape_123 "
"x1_and_a_name"
"string with \"double quotes\""
A string can be any length, and can span multiple lines without any special line-break syntax:
"This is an example of a very long string
with multiple lines.
Note that line breaks do not need to be marked using any special syntax."
==== Raw String Format (starting on Dinamica 5.0.1) ====
A raw string uses the following syntax:
$"( raw_characters )"
Where ''raw_characters'' is the string's content — any sequence of characters — and '''' is any character that, together with the closing parenthesis '')'', does not appear inside ''raw_characters''. The delimiter can be omitted entirely if the closing parenthesis alone doesn't appear in the content.
$"(This is an example of String)"
$"0(This is an example of String with the character ))0"
$"1(This is an example of String with the sequence of characters )0)1"
A raw string can also be any length and span multiple lines, with no special line-break syntax needed:
$"(This is an example of a very long string
with multiple lines.
Note that line breaks do not need to be marked using any special syntax.)"
===== Automatic Conversions =====
* **Converted from**: [[Boolean Value Type]], [[Code Type]], [[Index Or Name Type]], [[Integer Value Type]], [[Log Tag Type]], [[Name Type]], [[Non Negative Integer Value Type]], [[Positive Integer Value Type]], [[Real Value Type]], [[Folder Type]], [[Generic Filename Type]], [[Map Filename Type]], [[Table Filename Type]], [[Lookup Table Filename Type]], [[Weights Filename Type]], [[Kmz Filename Type]], [[Projection Type]], [[Elevation Graph Type]], and [[Table Value Type]] — the last can fail: it only succeeds if the Table Value Type actually holds a String.
* **Converted to**: [[Code Type]], [[Date Type]], [[Index Or Name Type]], [[Name Type]], [[Folder Type]], [[Generic Filename Type]], [[Map Filename Type]], [[Table Filename Type]], [[Lookup Table Filename Type]], [[Weights Filename Type]], [[Kmz Filename Type]], [[Projection Type]], [[Table Value Type]], and [[Tuple Type]]. [[Real Value Type]] — can fail; the string must parse as a valid number (e.g. ''"test"'' fails, ''"3.14"'' succeeds).
See [[type_system|Type System]] for the complete conversion reference across all types.