substr(text, number, 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, count: number): text

Returns the substring of source starting at start with length count.

Example

source = "Hello World!"

show summary "Substrings" with
  substr(source, 0, 3) as "0,3"
  substr(source, -3, 2) as "-3,2"
  substr(source, 6, 100) as "6,100"
  substr(source, 100, 257) as "100,257"
  substr(source, 2, -1) as "2,-1"

This outputs the following list:

Label Value
0,3 Hel
-3,2 ld
6,100 World!
100,257
2,-1

Remarks

Segments that fall outside source are clipped. Negative count returns an empty text.

See also

User Contributed Notes
0 notes + add a note