Compares this string to another

@param string $compare string to compare to
@param callable $callback
@return int
966571
public function compare($compare, callable $callback = null) {
		if ($callback === null) {
			$callback = 'strcmp';
		}
		return $callback($this->string, (string) $compare);
	}
596352
public function compareTo($other)
    {
        if ($other === null) {
            return false;
        }
        if (!($other instanceof FunctionNode)) {
            return false;
        }

        $thisOperand = $this->getOperand();
        $otherOperand = $other->getOperand();

        return $this->getName() == $other->getName() && $thisOperand->compareTo($otherOperand);
    }
261124
public function find($callback)
    {
        foreach ($this->value as $value) {
            if (call_user_func($callback, $value)) {
                return $value;
            }
        }
        
        return null;
    }
473947
public static function findFirst(array $data, callable $callback = null)
    {
        $results = static::find($data, $callback, false, 0, 1);

        return count($results) ? $results[0] : null;
    }
923221
public static function callbackUniqueId(callable $callback = null)
    {
        if (is_string($callback)) {
            return $callback;
        }
        if (is_object($callback)) {
            $callback = [$callback, ''];
        } else {
            $callback = (array) $callback;
        }
        if (is_object($callback[0])) {
            return spl_object_hash($callback[0]).$callback[1];
        } else {
            if (is_string($callback[0])) {
                return $callback[0].'::'.$callback[1];
            }
        }
    }
943361
public function walkComparison(Comparison $comparison)
    {
        $field = $comparison->getField();
        $value = $comparison->getValue()->getValue(); // shortcut for walkValue()

        if (isset($this->classMetadata->associationMappings[$field]) &&
            $value !== null &&
            ! is_object($value) &&
            ! in_array($comparison->getOperator(), array(Comparison::IN, Comparison::NIN))) {

            throw PersisterException::matchingAssocationFieldRequiresObject($this->classMetadata->name, $field);
        }

        return $this->persister->getSelectConditionStatementSQL($field, $value, null, $comparison->getOperator());
    }
900460
@Override
  public int compareTo(Object other) {
    if (other == null) {
      return -1;
    }
    TaskKey otherKey = (TaskKey) other;
    return new CompareToBuilder().appendSuper(super.compareTo(otherKey))
        .append(this.taskId, otherKey.getTaskId())
        .toComparison();
  }
318620
public function getDifferenceInSeconds($compare = null)
        {
            if (!$compare) {
                $compare = new Date(null, $this->getTimezone());
            }

            $difference = $this->diff($compare);

            list($days, $hours, $minutes, $seconds) = explode(':', $difference->format('%a:%h:%i:%s'), 4);

            // Add the total amount of seconds in all the days.
            $seconds += ($days * 24 * 60 * 60);

            // Add the total amount of seconds in all the hours.
            $seconds += ($hours * 60 * 60);

            // Add the total amount of seconds in all the minutes.
            $seconds += ($minutes * 60);

            return $seconds * $difference->format('%r1');
        }
321237
public function compareDate($date = null)
    {
        $start    = $this->createDateUTC($this->toDateString());
        $end      = $this->createDateUTC($date ? $date->toDateString() : date(static::DATE_STR));
        $interval = $end->diff($start);

        return (int)($interval->format('%r') . (bool)$interval->format('%a'));
    }
383599
final public static function compareValues ($firstValue, $secondValue) : int
	{
		if (!self::hasValue($firstValue, $secondValue)) new ErrorCode(1001);
	    return $firstValue <=> $secondValue;
	}
1295983
public function reject($callback = true)
    {
        $useAsCallable = $this->useAsCallable($callback);

        return $this->filter(function ($value, $key) use ($callback, $useAsCallable) {
            return $useAsCallable
                ? ! $callback($value, $key)
                : $value != $callback;
        });
    }
213098
public function countBy($callback = null)
    {
        if (is_null($callback)) {
            $callback = function ($value) {
                return $value;
            };
        }

        return new static($this->groupBy($callback)->map(function ($value) {
            return $value->count();
        }));
    }
555379
public function avg($callback = null)
    {
        $count = $this->count();

        return $count ? $this->sum($callback) / $count : null;
    }
728643
public function Compare( $other )
	{
		// BMS 2019-04-28
		// Probably need to do this for all other numeric types and the boolean
	    switch ( $other->GetValueCode() )
	    {
			case DecimalProxyFactory::Code:
				return 1;

	    	case StringProxyFactory::Code:
				return 0;

	        default:
	        	return -2;
	    }

		if ( $other->GetValueCode() == StringProxyFactory::Code )
	        return 0;
	    return -2;
	}
503970
public function sum($callback = null)
    {
        if (is_null($callback)) {
            return array_sum($this->items);
        }

        return array_reduce($this->items, function ($result, $item) use ($callback) {
            if (is_string($callback)) {
                return $result += $item->{$callback}();
            }

            return $result += $callback($item);
        }, 0);
    }
899746
public function walkComparison(Comparison $comparison) : Expr
    {
        switch ($comparison->getOperator()) {
            case Comparison::EQ:
            case Comparison::GT:
            case Comparison::GTE:
            case Comparison::IN:
            case Comparison::IS:
            case Comparison::LT:
            case Comparison::LTE:
            case Comparison::NEQ:
            case Comparison::NIN:
                $method = self::$operatorMethods[$comparison->getOperator()];

                return $this->builder->expr()
                    ->field($comparison->getField())
                    ->{$method}($this->walkValue($comparison->getValue()));

            case Comparison::CONTAINS:
                $value = $this->walkValue($comparison->getValue());

                return $this->builder->expr()
                    ->field($comparison->getField())
                    ->equals(new Regex($value, ''));

            default:
                throw new RuntimeException('Unknown comparison operator: ' . $comparison->getOperator());
        }
    }
530439
public function indexOf(callable $callback) {
    foreach ($this->nodes as $i => $node) {
      if ($callback($node)) {
        return $i;
      }
    }
    return -1;
  }