sort

Sort vector of strings in alphabetic order

Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

Syntax

stringVector2 = Streams.sort(stringVector1);
stringVector2 = Streams.sort(stringVector1, caseSensitive=true);

Description

Function sort(..) sorts a string vector stringVector1 in lexicographical order and returns the result in stringVector2. If the optional argument "caseSensitive" is false, lower and upper case letters are not distinguished.

Example

s1 = {"force", "angle", "pressure"};
s2 = Strings.sort(s1);
     -> s2 = {"angle", "force", "pressure"};

Syntax

stringVector2 = sort(stringVector1, caseSensitive)

Inputs (2)

stringVector1

Type: String[:]

Description: Vector of strings

caseSensitive

Default Value: true

Type: Boolean

Description: = false, if lower and upper case are ignored when comparing elements of stringVector1

Outputs (1)

stringVector2

Type: String[size(stringVector1, 1)]

Description: stringVector1 sorted in alphabetical order