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
932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 | |