Compare
Performs a case-sensitive comparison of two strings.
-1, if string1 is less than string2 0, if string1 is equal to string2 1, if string1 is greater than string2
Method Signature
Compare(string1=[any], string2=[any])
Arguments
Argument
Type
Required
Description
Default
string1
any
true
The first string to compare
string2
any
true
The second string to compare
Examples
Tag Syntax
<bx:set comparison = compare( "Boxlang", "boxlang" ) >
<bx:dump var="#comparison#"/>
Result: -1
Additional Examples
dump( Compare( "100 Main St.", "675 East Avenue" ) ); // -1
dump( Compare( "500 Main St.", "1 Cupertino Way" ) ); // 1
dump( Compare( "500 Main St.", "500 Main St." ) );
// 0
Related
Last updated
Was this helpful?