substr(text, number)

There are other functions named substr() with different numbers of arguments. See the entire list.

substr, function

def const pure substr(source: text, start: number): text

Returns the substring of source starting at start.

Example

source = "Hello World!"

show summary "Substrings" with
  substr(source, 0) as "start=0"
  substr(source, -3) as "start=-3"
  substr(source, 6) as "start=6"
  substr(source, 100) as "start=100"

This outputs the following list:

Label Value
start=0 Hello World!
start=-3 ld!
start=6 World!
start=100

Remarks

If source is shorter than start, the result is an empty text. substr(source, start) is equivalent to substr(source, start, +infinity).

See also

User Contributed Notes
0 notes + add a note