Text Statements
Note
While this section is up-to-date and complete, it has to be reformated to be easier on the eyes. All UPPERCASE statement names and code should be changed to lowercase.
IN _ JOIN _
The IN JOIN
statement concatenates two or more values and stores them in a TEXT variable. If any of those values is a number, it is converted to a string before concatenation.
Syntax:
1 |
|
Example:
1 |
|
will store
1 |
|
in myTextVariable
.
REPLACE _ WITH _ FROM _ IN _
The REPLACE
statement finds and replaces every occurrence of some TEXT in a TEXT variable or value some other TEXT. The result is then stored in a TEXT variable.
Syntax:
1 |
|
Example:
1 2 |
|
Outputs:
1 |
|
SPLIT _ BY _ IN _
The SPLIT
statement breaks up a single TEXT variable into multiple parts based on another TEXT variable and puts those parts into sub-indexes of a TEXT LIST
, starting at the NUMBER 0
and incrementing by whole numbers. This allows you to break up a text sentence into multiple parts by splitting on spaces, for example. Or to split a file into lines by splitting on "\n"
To break TEXT into individual characters, split by the empty string of ""
.
Syntax:
1 |
|
Example:
1 2 3 4 5 |
|
will output:
1 2 |
|
Split into characters:
1 2 3 4 5 |
|
will output:
1 |
|
GET CHARACTER AT _ FROM _ IN _
The GET CHARACTER AT
statement gets the character at the position indicated by the NUMBER value from the TEXT value and stores it in a TEXT variable.
Syntax:
1 |
|
GET LENGTH OF _ IN _
The GET LENGTH OF
statement counts the number of characters in the passed TEXT and stores that number in the NUMBER variable.
Syntax:
1 |
|
GET ASCII CHARACTER _ IN _
The GET ASCII CHARACTER
statement stores the character with the ASCII code passed in NUMBER or NUMBER-VAR in TEXT-VAR.
Syntax:
1 |
|
GET CHARACTER CODE OF _ IN _
The GET CHARACTER CODE OF
statement stores the ASCII code of the character passed in TEXT or TEXT-VAR in NUMBER-VAR. Will fail if the length of the string passed in TEXT or TEXT-VAR is not 1.
Syntax:
1 |
|
Error Codes:
Multi-byte characters (like emojis and non-ASCII characters) cannot be parsed by this statement. When trying to do so, the operation will fail and the following values will be returned into the ERRORCODE
and ERRORTEXT
variables:
ERRORCODE
: 1ERRORTEXT
: "Multibyte character received (probably UTF-8). Can't be parsed into a single number."
Warning
Always use the ERRORCODE
variable to check if the operation was successful or not. Do not use ERRORTEXT
for anything else than displaying the error found, as its contents may change in future releases of LDPL.
STORE QUOTE _ IN _
The STORE QUOTE IN
statement allows you to store multiple lines in a single TEXT variable. Between the STORE QUOTE IN
and END QUOTE
statements whitespace is preserved literally, escape codes like \t
and \e
work the same as they do in regular text variables (and can themselves be escaped using \\
), and double quotes ("
) don't need to be escaped.
Syntax:
1 2 3 |
|
Example:
1 2 3 4 5 6 7 8 9 10 11 12 |
|
GET INDEX OF _ FROM _ IN _
The GET INDEX OF - FROM - IN
statement stores in a NUMBER variable the position of the first occurrence of a specified value in a string or TEXT variable. The first position of a string (the first letter) is considered to be the position number 0
. The value -1
is stored if there are no occurrences.
Syntax:
1 |
|
Example:
1 2 3 4 5 6 |
|
COUNT _ FROM _ IN _
The COUNT - FROM - IN
statement counts all the appearances of a string in another string and stores that value in a NUMBER variable.
Syntax:
1 |
|
Example:
1 2 3 4 5 6 |
|
SUBSTRING _ FROM _ LENGTH _ IN _
The SUBSTRING - FROM - LENGTH - IN
statement extracts parts of a string, beginning at the character at the specified position and storing in the destination TEXT variable the specified number of characters.
Syntax:
1 |
|
Example:
1 2 3 4 5 6 7 |
|
TRIM _ IN
The TRIM - IN
statement removes whitespace from both sides of a string and stores the resulting string in a TEXT variable.
Syntax:
1 |
|
Example:
1 2 3 4 5 6 |
|
CONVERT _ TO UPPERCASE IN _
The CONVERT - TO UPPERCASE IN
statement converts all the characters in a string to uppercase and stores the resulting string in a TEXT variable.
Syntax:
1 |
|
Example:
1 2 3 4 5 6 |
|
CONVERT _ TO LOWERCASE IN _
The CONVERT - TO LOWERCASE IN
statement converts all the characters in a string to lowercase and stores the resulting string in a TEXT variable.
Syntax:
1 |
|
Example:
1 2 3 4 5 6 |
|