SUBSTRING

Description

Returns a substring extracted from the provided string, beginning at the start_index (inclusive) and ending at the end_index (exclusive). Indexing is zero-based.

Syntax

SUBSTRING(string, start_index, end_index) -> String

Parameters

ParameterData TypeRequiredDescription
stringStringYesThe original string.
start_indexIntegerYesThe starting index position (inclusive). Must be non-negative.
end_indexIntegerYesThe ending index position (exclusive). Must be greater than or equal to start_index.

Example

SUBSTRING("Order SO-10056 closed", 6, 14)
-- Returns "SO-10056".
-- Extracts characters from index 6 up to, but not including, index 14.

Tips

  • If end_index exceeds the length of the string, the substring extends to the end of the string.