-
-
Notifications
You must be signed in to change notification settings - Fork 18
Strings
Text in SGML is stored as a sequence of characters, commonly referred to as a string. Characters within this sequence are of type char and can be accessed using array literals. Strings are always defined within double quotation marks, while single character is defined within apostrophes.
string myString = "Hello World!";
char sequenceElement = myString[1]; //e
char anotherChar = 'A';
Strings are immutable, meaning that unless a value is assigned to a string its value will never change.
string myString = "Simplex engine";
string_replace(myString, " engine", ""); // takes myString, looks for " engine" and removes is
show_message_debug(myString); // Still returns "Simplex engine"
myString = string_replace(myString, "engine", ""); // myString is now just "Simplex"
Strings may contain special (escape) sequences to force behavior on demand. Escape sequences are defined as \x
where x is represented by one or more characters.
-
\n
- Insert line feed (newer line break) -
\t
- Insert tab -
\r
- Insert carriage return (line break on older systems) -
\'
- Insert single quote -
\"
- Insert double quote -
\\
- Insert backslash
If you'd prefer to omit this functionality, prepend your string with @
.
string myString = @"\folder\subfolder\file.txt";
Any font unsupported characters within a string will be replaced with a ▯ symbol. Easiest way to troubleshoot this is to increase glyph range of your font to include characters you are in need of.
- ansi_char
- chr
- ord
- real
- is_string
- sstring
- string_byte_at
- string_byte_length
- string_set_byte_at
- string_char_at
- string_ord_at
- string_copy
- string_count
- string_delete
- string_digits
- string_format
- string_insert
- string_length
- string_letters
- string_lettersdigits
- string_lower
- string_pos
- string_repeat
- string_replace
- string_replace_all
- string_upper
- string_height
- string_height_ext
- string_width
- string_width_ext
Other functions can check what keyboard input has been pressed. These functions are as follows:
Back to Manual