Description
The sort
function is used to sort a list of entries. The entries in the list are separated by a specified string (separator
). Optionally, the sort direction can be controlled via the direction
parameter.
- By default, the list is sorted in ascending order.
- If
direction
is set to-1
, the sorting is done in descending order.
Syntax
sort(list, separator[, direction])
Arguments
Argument | Description |
---|---|
list | The string to be sorted. The entries in the list must be separated by the separator . |
separator | The string used as a delimiter for the entries in the list. |
direction (optional) | Specifies the sort direction:
|
Return Types
The function returns a sorted list where the entries are separated by the specified separator
.
Examples
Description | Formula | Result |
---|---|---|
Sort in ascending order |
sort("B,C,A", ",") |
"A,B,C" |
Sort in descending order |
sort("B,C,A", ",", -1) |
"C,B,A" |
Notes
- The
sort
function is useful for creating ordered representations of data or texts. - The separators (
separator
) should be unique and consistent to avoid unwanted results.
Comments
0 comments
Please sign in to leave a comment.