---
title: "sortStrings"
canonical: "https://help.vicon.com/space/ShogunPost121/1253736511/sortStrings"
format: markdown
---
# 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

> Macro (scroll-tablelayout)

|  |
| --- |
| `sortStrings stringArray [-d] [-numeric]` |

### Arguments

| Name | Type | Required | Comments |
| --- | --- | --- | --- |
| `stringArray` | string array | yes | The array to sort |

### Flags

> Macro (scroll-tablelayout)

| 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 

> Macro (scroll-pagebreak)

## Examples

```plaintext
// Demonstrate a simple sort.
string $array[3;
$array[0] = "apple";
$array[1] = "Berry;
$array[2] = "Apple";
string $sortedArray[] = `sortStrings $array`;
print $sortedArray;
```

# Additional information

## Related commands

- [sortFloats](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737671)
- [sortInts](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737268)