Comparison
Syntax
$string1.isStringGreater($string2)
$string1.isStringGreater($string2, $case-sensitive)
Description
Compares the two strings string1
and string2
lexiographically. The comparison is done character by character. As soon as a character of string1
is greater than the character at the same position of string2
, true
is returned.
Parameter
Name | Type | Description | Mandatory | Default |
---|---|---|---|---|
string1 | String | The string to compare string2 with. |
yes | |
string2 | String | The string to compare string1 with. |
yes | |
case-senitive | Boolean | Determines whether case sensitivity should be considered. | no | false - case sensitivity is not considered. |
Return value
Type: Boolean
Whether string1
is lexiographically greater than string2
.
Examples
Simple comparison
isStringGreater("def", "abc")
Output: true
Identical strings
isStringGreater("abc" "abc")
Output: false
Different character length
isStringGreater("g", "abcdef")
Output: false
The fact that the first string is shorter than the second is irrelevant in the comparison.
Non-Casesensitive comparison
isStringGreater("abc", "ABC")
Output: false
Since no case sensitivity is applied, both strings are the same size.
Casesensitive comparison
isStringGreater("abc", "ABC", true)
Output: true
a is greater than A.