SUBS is a CAOS function which extracts a substring.


Syntax: SUBS str (string) start (int) count (int)

Extracts and returns a substring of str starting at index start and of length count. String indices start at 1.

start must be no more than STRL str and the value of count must not be such that start + count > STRL str. Otherwise the command fails with "Slice attempted outside string."

If count is negative, SUBS returns str from start to the end. So SUBS str s -1 is like SUBS str s ((STRL str) - s).

Warning sign
The behaviour of this function with negative count is based on observed behaviour and is not documented by MANN.


OUTS SUBS "shush" 2 3
OUTS SUBS "shush" 3 -1

See also

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.