Class StringCompare

java.lang.Object
ortus.boxlang.runtime.operators.StringCompare
All Implemented Interfaces:
IOperator

public class StringCompare extends Object implements IOperator
Operator to compare two strings and bypass any additional cast attempts
  • Constructor Details

    • StringCompare

      public StringCompare()
  • Method Details

    • invoke

      public static int invoke(String left, String right)
      Invokes the comparison
      Parameters:
      left - The left operand
      right - The right operand
      Returns:
      1 if greater than, -1 if less than, = if equal
    • invoke

      public static int invoke(String left, String right, Boolean caseSensitive)
      Invokes the comparison
      Parameters:
      left - The left operand
      right - The right operand
      caseSensitive - Whether to compare strings case sensitive
      Returns:
      1 if greater than, -1 if less than, = if equal
    • invoke

      public static int invoke(String left, String right, Boolean caseSensitive, Locale locale)
      Invokes the comparison
      Parameters:
      left - The left operand
      right - The right operand
      caseSensitive - Whether to compare strings case sensitive
      locale - The locale to use for comparison
      Returns:
      1 if greater than, -1 if less than, = if equal
    • attempt

      public static Integer attempt(String left, String right, Boolean caseSensitive, boolean fail)
      Invokes the comparison
      Parameters:
      left - The left operand
      right - The right operand
      caseSensitive - Whether to compare strings case sensitive
      fail - True to throw an exception if the left and right arguments cannot be compared
      Returns:
      1 if greater than, -1 if less than, = if equal
    • attempt

      public static Integer attempt(String left, String right, Boolean caseSensitive, boolean fail, Locale locale)
      Invokes the comparison
      Parameters:
      left - The left operand
      right - The right operand
      caseSensitive - Whether to compare strings case sensitive
      fail - True to throw an exception if the left and right arguments cannot be compared
      locale - The locale to use for comparison
      Returns:
      1 if greater than, -1 if less than, = if equal