Skip to content

__substr__

strings · scripts/strings/__substr__.m

: t = substr (s, offset)
: t = substr (s, offset, len)

Extract part of a string by start position and length.

offset is the 1-based first column (-1 means the last column). Without len the text runs to the end. A positive len is a character count; a negative one leaves that many characters (less one) off the end; zero gives an empty result. For a char matrix every row is cut the same way.