pure functioncompare
Compare two strings lexicographically
Extends from Modelica.Icons.Function (Icon for functions).
Information
Syntax
result = Strings.compare(string1, string2); result = Strings.compare(string1, string2, caseSensitive=true);
Description
Compares two strings. If the optional argument caseSensitive=false, upper case letters are treated as if they would be lower case letters. The result of the comparison is returned as:
result = Modelica.Utilities.Types.Compare.Less // string1 < string2
= Modelica.Utilities.Types.Compare.Equal // string1 = string2
= Modelica.Utilities.Types.Compare.Greater // string1 > string2
Comparison is with regards to lexicographical order, e.g., "a" < "b";
It is intended for ASCII, the case-insensitive comparison is not guaranteed to work for UTF-8.
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| String | string1 | ||
| String | string2 | ||
| Boolean | caseSensitive | true | = false, if case of letters is ignored |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Utilities.Types.Compare | result | Result of comparison |