Compares given string with this string (not multibyte safe)

@inheritdoc
@throws InvalidArgumentException
@throws TypeError
551422
public function compareTo($string): int
    {
        Assert::typeOf(['string', __CLASS__], $string);

        return strcmp($this->data, (string) $string) <=> 0;
    }
951803
public function isValid($mixed, ArrayAccess $error = null)
    {
        if ($mixed !== null && !is_string($mixed)) {
            throw new InvalidArgumentException(t('Invalid type supplied to validator.'));
        }

        if ($this->getMaximumLength() < strlen($mixed)) {
            if ($error && $message = $this->getErrorString(self::E_TOO_LONG, $mixed)) {
                $error[] = $message;
            }

            return false;
        }

        return true;
    }
34424
public static boolean compareNullableString(@Nullable String string, SoyValue other) {
    // This is a parallel version of SharedRuntime.compareString except it can handle a null LHS.

    // This follows similarly to the Javascript specification, to ensure similar operation
    // over Javascript and Java: http://www.ecma-international.org/ecma-262/5.1/#sec-11.9.3
    if (other instanceof StringData || other instanceof SanitizedContent) {
      return Objects.equals(string, other.toString());
    }
    if (other instanceof NumberData) {
      if (string == null) {
        return false;
      }

      try {
        // Parse the string as a number.
        return Double.parseDouble(string) == other.numberValue();
      } catch (NumberFormatException nfe) {
        // Didn't parse as a number.
        return false;
      }
    }
    return false;
  }
591363
private static function hash_compare($a, $b) {
    if (!is_string($a) || !is_string($b)) {
      return FALSE;
    }

    $len = strlen($a);
    if ($len !== strlen($b)) {
      return FALSE;
    }

    $status = 0;
    for ($i = 0; $i < $len; $i++) {
      $status |= ord($a[$i]) ^ ord($b[$i]);
    }
    return $status === 0;
  }
2717
public function parseString($string)
    {
        if (!mb_strlen($string)) {
            throw new \InvalidArgumentException('Option string must not be empty');
        }
        $options = array();
        $eol = mb_strlen($string) - 1;
        $nextCanBeColon = false;
        for ($i = 0; $i <= $eol; ++$i) {
            $ch = $string[$i];
            if (!preg_match('/^[A-Za-z0-9]$/', $ch)) {
                $colon = $nextCanBeColon ? " or ':'" : '';
                throw new \InvalidArgumentException("Option string is not well formed: "
                    ."expected a letter$colon, found '$ch' at position ".($i + 1));
            }
            if ($i == $eol || $string[$i + 1] != ':') {
                $options[] = new Option($ch, null, Getopt::NO_ARGUMENT);
                $nextCanBeColon = true;
            } elseif ($i < $eol - 1 && $string[$i + 2] == ':') {
                $options[] = new Option($ch, null, Getopt::OPTIONAL_ARGUMENT);
                $i += 2;
                $nextCanBeColon = false;
            } else {
                $options[] = new Option($ch, null, Getopt::REQUIRED_ARGUMENT);
                ++$i;
                $nextCanBeColon = true;
            }
        }
        return $options;
    }
271320
public function encode($string)
    {
        // Type validation
        if (is_string($string) === false) {
            throw new InvalidArgumentException('Argument $string must be a string.');
        }

        // If the string is empty, then the encoded string is obviously empty
        if (strlen($string) === 0) {
            return '';
        }

        // Now we need to convert the byte array into an arbitrary-precision decimal
        // We basically do this by performing a base256 to base10 conversion
        $hex = unpack('H*', $string);
        $hex = reset($hex);
        $decimal = gmp_init($hex, 16);

        // This loop now performs base 10 to base 58 conversion
        // The remainder or modulo on each loop becomes a base 58 character
        $output = '';
        while (gmp_cmp($decimal, $this->base) >= 0) {
            list($decimal, $mod) = gmp_div_qr($decimal, $this->base);
            $output .= $this->alphabet[gmp_intval($mod)];
        }

        // If there's still a remainder, append it
        if (gmp_cmp($decimal, 0) > 0) {
            $output .= $this->alphabet[gmp_intval($decimal)];
        }

        // Now we need to reverse the encoded data
        $output = strrev($output);

        // Now we need to add leading zeros
        $bytes = str_split($string);
        foreach ($bytes as $byte) {
            if ($byte === "\x00") {
                $output = $this->alphabet[0] . $output;
                continue;
            }
            break;
        }

        return (string) $output;
    }
661278
public function equals($string)
    {
        $string = StdObjectWrapper::toString($string);

        // we double-cast the $string param to string, because integer is also a string, but in strcmp function integer
        // can cause unwanted mismatches if it's not strictly casted to string
        $result = strcmp((string)$string, $this->val());
        if ($result !== 0) {
            return false;
        }

        return true;
    }
1362174
public function checkValue(&$value)
    {
        if (is_string($value)) {
            $value = Placeholder::replaceStringsAndComments($value);
            $value = Placeholder::removeCommentPlaceholders($value, true);
            $value = Placeholder::replaceStringPlaceholders($value, true);
            $value = trim($value);

            if ($value !== '') {
                return true;
            } else {
                $this->setIsValid(false);
            }
        } else {
            throw new \InvalidArgumentException(
                "Invalid type '" . gettype($value). "' for argument 'value' given."
            );
        }
    }
247277
async function compareString (filename, expectedContents) {
  try {
    const actualContents = await fs.readFile(filename, { encoding: 'utf8' })
    return actualContents !== expectedContents
  } catch (err) {
    return handleError(err)
  }
}
966571
public function compare($compare, callable $callback = null) {
		if ($callback === null) {
			$callback = 'strcmp';
		}
		return $callback($this->string, (string) $compare);
	}
958739
protected function isValidString(string $value, int $length = 20): void
    {
        if (mb_strlen($value) > $length) {
            throw new InvalidStringException(sprintf('String should not exceed %s characters.', $length));
        }
    }
1023083
function fromString( $string )
    {
        $dataType = $this->dataType();
        if ( $dataType )
            return $dataType->fromString( $this, $string );
        else
            return false;
    }
311096
public function unserialize($string)
    {
        if (version_compare($this->productMetadata->getVersion(), '2.2.0', '>=')) {
            $objManager = \Magento\Framework\App\ObjectManager::getInstance();
            /** @var \Magento\Framework\Serialize\Serializer\Json $serializer */
            $serializer = $objManager->create('Magento\Framework\Serialize\Serializer\Json');
            return $serializer->unserialize($string);
        }

        $result = json_decode($string, true);
        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new \InvalidArgumentException('Unable to unserialize value.');
        }
        return $result;
    }
1305867
public function parse( $string )
	{
		if( !is_string( $string ) )														//  no String given
			throw new InvalidArgumentException( 'Given argument is not a string' );		//  throw Exception

		$this->extendPossibleOptionsWithShortcuts();									//  realize Shortcuts

		$position	= 0;																//  initiate Sign Pointer
		$status		= self::STATUS_START;												//  initiate Status
		$buffer		= "";																//  initiate Argument Buffer
		$option		= "";																//  initiate Option Buffer

		while( isset( $string[$position] ) )											//  loop until End of String
		{
			$sign	= $string[$position];												//  get current Sign
			$position ++;																//  increase Sign Pointer

			switch( $status )															//  handle Sign depending on Status
			{
				case self::STATUS_START:												//  open for all Signs
					$this->onReady( $sign, $status, $buffer, $option );					//  handle Sign
					break;
				case self::STATUS_READ_OPTION_KEY:										//  open for Option Key Signs
					$this->onReadOptionKey( $sign, $status, $buffer, $option );			//  handle Sign
					break;
				case self::STATUS_READ_OPTION_VALUE:									//  open for Option Value Signs
					$this->onReadOptionValue( $sign, $status, $buffer, $option );		//  handle Sign
					break;
				case self::STATUS_READ_ARGUMENT:										//  open for Argument Signs
					$this->onReadArgument( $sign, $status, $buffer );					//  handle Sign
					break;
			}
		}
		$this->onEndOfLine( $status, $buffer, $option );								//  close open States
	}
405233
public function compareTo($str2, $caseSensitive = true)
    {
        $str2   = $caseSensitive ? $str2 : strtolower($str2);
        $string = $caseSensitive ? $this->returnValue : strtolower($this->returnValue);
        return ($string == $str2);
    }
57049
protected function validateNumber($number) {
    if (!(is_int($number) || is_string($number) && is_numeric($number))) {
      $type = is_object($number) ? get_class($number) : gettype($number);
      throw new \InvalidArgumentException(sprintf('An integer or numeric string was expected, but %s was given.', $type));
    }
  }
1178567
public function compareToIgnoreCase($string): int
    {
        Assert::typeOf(['string', __CLASS__], $string);

        return strcasecmp($this->data, (string) $string) <=> 0;
    }