Sort()

From TinyMUX
Jump to navigation Jump to search


sort(<list>[, <sort type>[, <idelim>[, <odelim>]]])

Takes a list of words, numbers or dbrefs, and sorts them into ascending order. By default, lexicographic order is used for words, and numeric order is used for numbers and dbrefs.

<sort type> may be used to specify the type of sort to perform (use 'd' for dbref, 'n' for integer numeric, 'f' for floating numeric, 'a' for case-sensitive alphanumeric, 'i' for case-insensitive alphanumeric, and '?' for automatic typing). If omitted, '?', or left blank, the sort() function will try to determine the type of sort to perform automatically.

By default, the output delimiter, <odelim>, defaults to the input delimiter, <idelim>, which itself defaults to a space. Delimiters here, like most other functions, are used to separate items in a list.

Example

> say sort(This is a test)

You say, "This a is test"

> say sort(98 100 99 101,n)

You say, "98 99 100 101"

> say sort(foo-bar-bletch,,-,|)

You say, "bar|bletch|foo"

Related Topics

munge(), sortby()