daft.functions.substr#
substr #
substr(expr: Expression, start: int | Expression, length: int | Expression | None = None) -> Expression
Extract a substring from a string, starting at a specified index and extending for a given length.
Returns:
| Name | Type | Description |
|---|---|---|
Expression | Expression | A String expression representing the extracted substring. |
Note
If length is not provided, the substring will include all characters from start to the end of the string.
Examples:
1 2 3 4 5 | |
╭────────╮
│ x │
│ --- │
│ String │
╞════════╡
│ ft │
├╌╌╌╌╌╌╌╌┤
│ ery │
├╌╌╌╌╌╌╌╌┤
│ gine │
╰────────╯
(Showing first 3 of 3 rows) Source code in daft/functions/str.py
797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 | |