Description
Alphabetically sort a list of strings stored in an array. The sorting will be case sensitive, meaning that the letters A-Z will get sorted before a-z.
Functional area
System
Command syntax
Syntax
sortStrings stringArray [-d] [-numeric] |
Arguments
Name | Type | Required | Comments |
---|---|---|---|
stringArray | string array | yes | The array to sort |
Flags
Name | Flag arguments | Argument type | Exclusive to | Comments |
---|---|---|---|---|
d | 0 | — | — | Sorts in descending order. Default is to sort in ascending order. |
numeric | Sorts strings numerically |
Return value
string array
Examples
// Demonstrate a simple sort.
string $array[3;
$array[0] = "apple";
$array[1] = "Berry;
$array[2] = "Apple";
string $sortedArray[] = `sortStrings $array`;
print $sortedArray;