compare

Compare two values.


Syntax


Parameters

  • Mixed term1 - The first term.
  • Mixed term2 - The second term.
  • Number method - Sort method options.
    • 0 (default) - Compare items using standard comparison.
    • 1 - Compare items numerically.
    • 2 - Compare items as case-sensitive strings.
    • 3 - Compare items as case-insensitive strings.
    • 4 - Compare items as case-sensitive strings, using natural ordering.
    • 5 - Compare items as case-insensitive strings, using natural ordering.
    • 6 - Compare items as case-sensitive strings, according to locale.
    • 7 - Compare items as case-insensitive strings, according to locale.
  • Number length - Determines how many of the characters from each String will be used for comparison.


Result

  • Number - The comparison result.
    • < 0 - A Number less than 0 is returned if term1 is less than term2.
    • 0 - A Number less than 0 is returned if term1 and term2 are equal.
    • > 0 - A Number greater than 0 is returned if term1 is greater than term2.

Returns a Number signifying which of the two terms being compared is greater.