Checks that the value ends with $str.
@param $str string the substring with which the value must end.
@param $msg string the error message.
978325
public function endsWith($str, $msg)
    {
        if(strlen($this->_value) > 0 && substr($this->_value, strlen($str) * -1) !== $str) {
            $this->_errors[] = $msg;
        }
        return $this;
    }
369505
public static function checkMinLength($field, $minLength, $msg)
    {
        if ((StringUtils::isEmpty($field) === false) && mb_strlen($field) < $minLength) {
            throw new MsgException($msg);
        }
    }
690451
static function End($string, $length = 0)
    {    
        self::InitEncoding();
        $pos = max(0, self::Length($string) - $length);
        return self::Part($string, $pos);
    }
716681
protected function _processString($str, $opts)
    {
        if (!empty($opts['length'])) {
            return substr($str, empty($opts['start']) ? 0 : $opts['start'], $opts['length']);
        } elseif (!empty($opts['start'])) {
            return substr($str, $opts['start']);
        }

        return $str;
    }
680854
public static function strlen($str) {
    if (is_array($str))
      return false;

    if (function_exists('mb_strlen'))
      return mb_strlen($str, 'UTF-8');

    return strlen($str);
  }
495144
function ends_withp(str, substr) {
        return slice(str, str.length - substr.length) == substr
    }
661421
private function strAdd(string $str, string $insertstr, int $pos):string
    {
        $str = substr($str, 0, $pos) . $insertstr . substr($str, $pos);
        return $str;
    }
1260325
public static void ensureEndsWithSlash(StringBuilder str) {
        if (str.length() == 0 || str.charAt(str.length() - 1) != '/') {
            str.append('/');
        }
    }
157202
public static function strExists($str, $string)
    {
        $string = (string) $string;
        $str    = (string) $str;
        return strstr($string, $str) === false ? false : true;
    }
100499
function ParseStr($str) {
		$this->Clear();

		$this->modifyContent($str);

		$pos = strpos($str, '@');
		while ($pos !== false) {
			$start = $pos;
			$pos++;
			$media = '';
			$count = -1;

			while(true) {
				if ($str[$pos] == '{') {
					if ($count == -1) {
						$media = substr($str, $start, ($pos-$start));
						$count = 0;
					}
					$count++;
				}
				if ($str[$pos] == '}') $count--;

				if ($count == 0) {
					$end = $pos;

					$fullmedia = substr($str, $start, ($end-$start)+1);

					$subparse = substr($fullmedia, strpos($fullmedia, '{')+1);

					$subparse = substr($subparse, 0, -1);

					$cssparser = new Css($this->prefix);
					$cssparser->SetUrl($this->thisUrl);
					$cssparser->ParseStr($subparse);
					$codestr = $cssparser->GetCSS();

					$str = str_replace($fullmedia, '', $str);
					$this->Add($media, $codestr);
					$pos = 0;
					break;
				}
				$pos++;
				if ($pos == strlen($str)) break;
			}
			$pos = strpos($str, '@', $pos);
		}

		if (preg_match_all('#([^}]*){([^}]*)}#Sis', $str, $parts)) {
			foreach($parts[1] as $key => $keystr) {
				$codestr = trim($parts[2][$key]);
				$keys = explode(',', trim($keystr));
				if(count($keys)) {
					foreach($keys as $value) {
						$value = trim($value);
						if(strlen($value)) {
							$this->Add($value, $codestr);
						}
					}
				}
			}
		}
		return (count($this->css) > 0);
	}
1209616
function msg(str) {
	if (str == null) {
		return null;
	}

	for (var i = 1, len = arguments.length; i < len; ++i) {
		str = str.replace('{' + (i - 1) + '}', String(arguments[i]));
	}

	return str;
}
1222582
public static function isString($str)
    {
        if (strlen($str) === 0) {
            return null;
        }
        if ($str[0] === '\'') {
            return Token::FLAG_STRING_SINGLE_QUOTES;
        } elseif ($str[0] === '"') {
            return Token::FLAG_STRING_DOUBLE_QUOTES;
        }

        return null;
    }
973361
public static function checkLength($field, $length, $msg)
    {
        if ((StringUtils::isEmpty($field) === false) && mb_strlen($field) != $length) {
            throw new MsgException($msg);
        }
    }
1366252
private function evalString($str)
    {
        $a = false;

        if (class_exists('ParseError')) {
            try {
                $a = eval("return $str;");
            } catch (ParseError $e) {
            }
        } else {
            $a = @eval("return $str;");
        }

        return $a;
    }
366229
public function substr($str, $offset = 0, $length = null)
    {
        // Due fix of PHP #62759 The third argument returns an empty string if is 0 or null.
        if ($length !== null) {
            return grapheme_substr($str, $offset, $length);
        }

        return grapheme_substr($str, $offset);
    }
817609
public function notStartsWith($str, $msg)
    {
        if(strlen($this->_value) > 0 && substr($this->_value, 0, strlen($str)) === $str) {
            $this->_errors[] = $msg;
        }
        return $this;
    }
380468
public static function isTagged(string $str): bool
    {
        return isset($str[1]) && strpos($str, '@') === 0 && ctype_alpha($str[1]);
    }