substr
Description
Extracts a substring from a string starting at a given position, with an optional length. Useful for simple value extraction without needing regular expressions.
Syntax
Like many functions in DataPrime, substr supports two notations, function and method notation. These interchangeable forms allow flexibility in how you structure expressions.
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
| value | string | true | The string to extract from |
| from | number | true | The starting index for the substring |
| length | number | false | Number of characters to return. Defaults to the remainder of the string |
Example
Extract the value after a delimiter
Consider the following document:
First, find the position of = with indexOf, then use substr to capture everything after it:
Example query
Example output
Theme
Light