Stay organized with collections
Save and categorize content based on your preferences.
Extracts the substring between two zero-based indexes of a source string.
A negative index is considered an offset from the end of the string. If an
index is outside of the source string's range, it is clamped to the bounds of
the range.
Both start and end arguments are required; otherwise, a deployment error
occurs.
Arguments
Arguments
source
string
The string whose substring will be returned.
start
int
The start index (inclusive) of the substring. Index is zero-based.
end
int
The end index (exclusive) of the substring. Index is zero-based.
Returns
The substring.
Raised exceptions
Exceptions
TypeError
If source is not a string; or, if either start or end is not an integer.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Function: text.substring\n\nExtracts the substring between two zero-based indexes of a source string.\n\nA negative index is considered an offset from the end of the string. If an\nindex is outside of the source string's range, it is clamped to the bounds of\nthe range.\n\nBoth `start` and `end` arguments are required; otherwise, a deployment error\noccurs.\n\nArguments\n---------\n\nReturns\n-------\n\nThe substring.\n\nRaised exceptions\n-----------------\n\nExamples\n--------\n\n### Example 1\n\n```yaml\n- returnStep:\n return: ${text.substring(\"hello\", 2, 4)} # returns \"ll\"\n```\n\n### Example 2\n\n```yaml\n# Negative index is offset from string end and clamped to range bounds\n- returnStep:\n return: ${text.substring(\"hello\", -10, 10)} # returns \"hello\"\n```"]]