Strings

Strings in RuLA represent text values. They are enclosed in double quotes.

Creating Strings

Create a string by enclosing text in double quotes:

"Hello World"
"Customer Name"
""

An empty string ("") is valid and represents a string with no characters.

String Manipulation

Concatenation

Join strings together using + or CONCAT:

"Hello" + " " + "World"     # Results in "Hello World"
CONCAT("Hello", " World")   # Results in "Hello World"

Accessing Characters

Access individual characters by index (0-based):

"Hello"[0]      # Returns "H"
"Hello"[4]      # Returns "o"

Slicing

Extract a portion of a string:

Case Conversion

Trimming Whitespace

Useful String Functions

Function
Description
Example

Returns the number of characters

LEN("abc") β†’ 3

Joins multiple strings

CONCAT("a", "b") β†’ "ab"

Converts to lowercase

LOWER("ABC") β†’ "abc"

Converts to uppercase

UPPER("abc") β†’ "ABC"

Removes whitespace from both ends

TRIM(" a ") β†’ "a"

First n characters

LEFT("hello", 2) β†’ "he"

Last n characters

RIGHT("hello", 2) β†’ "lo"

Extract substring

SLICE("hello", 1, 3) β†’ "el"

Replace occurrences

REPLACE("a-b", "-", "/") β†’ "a/b"

Split into list

SPLIT("a,b", ",") β†’ ["a", "b"]

Check prefix

STARTS_WITH("abc", "ab") β†’ True

Check suffix

ENDS_WITH("abc", "bc") β†’ True

Join list into string

JOIN(["a", "b"], "-") β†’ "a-b"

Format as string

FORMAT_NUMBER(3.14159, 2) β†’ "3.14"

Edit distance

LEVENSHTEIN("kitten", "sitting") β†’ 3

Pad on left

PAD_LEFT("5", 3, "0") β†’ "005"

Pad on right

PAD_RIGHT("5", 3, "0") β†’ "500"

Removes whitespace from start

TRIM_LEFT(" hello") β†’ "hello"

String Comparison

Compare strings using standard operators:

Last updated

Was this helpful?