Brass Core Plugins

strsub

Retrieves a substring.

Syntax

strsub(string, start [, length])

Remarks

If the start index is a negative value then the substring is returned start characters from the end of the string rather than from the beginning.

Example

A function to reverse a string.

.function rev(s)
    rev = ""
    .for i = 1, i <= strlength(s), ++i
        rev += strsub(s, -i, 1)
    .loop
.endfunction

; Displays "Hello!"
.echoln rev("!olleH")