TinyMUX

Butlast()

Functions

Description

FUNCTION: butlast(<string>[, <sep>])

Returns all but the last word of a string. This is the symmetric complement to rest(), which returns all but the first word.

If the string contains zero or one words, an empty string is returned.

An optional separator may be specified to use a delimiter other than a space.

Examples

> say butlast(This is a test)

You say, “This is a”

> say butlast(one)

You say, ""

> say butlast(a-b-c-d, -)

You say, “a-b-c”

extract(), first(), last(), rest()