Navigation :
substr(text, number)
substr(text, number), function
def const pure substr(source: text, start: number): text
Returns a sub-value from a source text, and a starting position.
source
: the source text
start
: if non-negative, the offset (zero-indexed) from the beginning of source
; otherwise the offset (one-indexed) from the end of source
Examples
source = "Hello World!"
show summary "" a1a4 with
substr(source, 0) // returns "Hello World!"
substr(source, -3) // returns "ld!"
substr(source, 6) // returns "World!"
substr(source, 100) // returns ""
If source
is shorter than start
characters, the function will return an empty text (as illustrated hereinabove).
substr(source, start)
is equivalent to substr(source, start, +infinity)
.
See also