Skip to content

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:

SLICE("Hello World", 0, 5)     # Returns "Hello"
LEFT("Hello World", 5)         # Returns "Hello"
RIGHT("Hello World", 5)        # Returns "World"

Case Conversion

LOWER("Hello World")           # Returns "hello world"
UPPER("Hello World")           # Returns "HELLO WORLD"

Trimming Whitespace

TRIM("  hello  ")              # Returns "hello"
TRIM_LEFT("  hello")           # Returns "hello"

Useful String Functions

Function Description Example
LEN Returns the number of characters LEN("abc")3
CONCAT Joins multiple strings CONCAT("a", "b")"ab"
LOWER Converts to lowercase LOWER("ABC")"abc"
UPPER Converts to uppercase UPPER("abc")"ABC"
TRIM Removes whitespace from both ends TRIM(" a ")"a"
LEFT First n characters LEFT("hello", 2)"he"
RIGHT Last n characters RIGHT("hello", 2)"lo"
SLICE Extract substring SLICE("hello", 1, 3)"el"
REPLACE Replace occurrences REPLACE("a-b", "-", "/")"a/b"
SPLIT Split into list SPLIT("a,b", ",")["a", "b"]
STARTS_WITH Check prefix STARTS_WITH("abc", "ab")True
ENDS_WITH Check suffix ENDS_WITH("abc", "bc")True
JOIN Join list into string JOIN(["a", "b"], "-")"a-b"
FORMAT_NUMBER Format as string FORMAT_NUMBER(3.14159, 2)"3.14"
LEVENSHTEIN Edit distance LEVENSHTEIN("kitten", "sitting")3
PAD_LEFT Pad on left PAD_LEFT("5", 3, "0")"005"
PAD_RIGHT Pad on right PAD_RIGHT("5", 3, "0")"500"
TRIM_LEFT Removes whitespace from start TRIM_LEFT(" hello")"hello"

String Comparison

Compare strings using standard operators:

"abc" = "abc"           # True (exact match)
"abc" != "def"          # True
"abc" contains "b"      # True
"abc" matches "a.*c"    # True (regex match)