ensureRight

@param string      $string
@param string      $search
@param string|null $encoding

@return  string
488130
public static function ensureRight($string, $search, $encoding = null)
    {
        if (static::endsWith($string, $search, true, $encoding)) {
            return $string;
        }

        return $string . $search;
    }
12619
protected function strReplaceOnce(string $search, string $replace, string $subject): string
    {
        $pos = strpos($subject, $search);
        if ($pos === false) {
            return $subject;
        }

        return substr($subject, 0, $pos) . $replace . substr($subject, $pos + strlen($search));
    }
1284029
public function isCharset($string, $encoding)
    {
        return strtoupper($this->detect($string, [], true)) == strtoupper($encoding);
    }
831145
public static function contains($value, string $search, string $encoding = 'UTF-8'): bool
    {
        if (!static::isStringCastable($value)) {
            return false;
        }

        return mb_strpos((string) $value, $search, 0, $encoding) !== false;
    }
386280
protected function replaceFirstSequentially($search, array $replace, $subject, $encoding, &$count)
	{
		$offset = 0;
		$lenSearch = mb_strlen($search, $encoding);
		foreach ($replace as $value) {
			$subject = $this->replaceFirstOne($search, $value, $subject, $encoding, $count, $offset, $lenSearch);
			if($offset === false)
				break;
		}
		return $subject;
	}
984305
public static String getRight(String key) {
        if (key.contains("|") && !key.startsWith("|")) {
            return key.substring(key.indexOf("|") + 1);
        } else {
            return key;
        }
    }
1224864
function before( string $search ) : SplString
    {
        if( $search === '' ){
            return $this;
        } else{
            return $this->setString( explode( $search, $this->__toString() )[0] );
        }
    }
820223
public function escapeCss($string, $encoding = 'utf-8') {
		
		$current = Escape :: getEncoding();
		Escape :: setEncoding($encoding);
		$result =  Escape :: css($string);
		Escape :: setEncoding($current);

		return $result;
	}
1123328
public static function removeChar($string, $offset, $length = null, $encoding = null)
    {
        $encoding = $encoding === null ? mb_internal_encoding() : $encoding;

        if (Mbstring::strlen($string, $encoding) < abs($offset)) {
            return $string;
        }

        $length = $length === null ? 1 : $length;

        return Mbstring::substrReplace($string, '', $offset, $length, $encoding);
    }
849730
static function lock($string, $key = null) {
        return openssl_encrypt($string, self::_getSecMethod(), Utils::spare($key, self::_geteSecKey()), false, self::_getSecIv());
    }
496811
protected function replaceLastOne($search, $replace, $subject, $encoding, &$count, &$offset = null, $lenSearch = null)
	{
		$target = mb_substr($subject, 0, $offset, $encoding);
		$position = mb_strrpos($target, $search, 0, $encoding);

		if ($position === false){
			$offset = false;
			return $subject;
		}

		$lenSearch = is_null($lenSearch) ? mb_strlen($search, $encoding) : $lenSearch;

		$start = mb_substr($subject, 0, $position, $encoding);
		$end = $replace.mb_substr($subject, $position+$lenSearch, null, $encoding);

		$offset = -mb_strlen($end, $encoding);
		++$count;

		return $start.$end;
	}
543432
protected function stringEndsWith($string, $stringToSearch)
    {
        return (substr($string, strlen($string) - strlen($stringToSearch)) === $stringToSearch);
    }
6848
public static function getChar($string, $pos, $encoding = null)
    {
        $encoding = $encoding === null ? mb_internal_encoding() : $encoding;

        if (Mbstring::strlen($string, $encoding) < abs($pos)) {
            return '';
        }

        return Mbstring::substr($string, $pos, 1);
    }
112222
protected function parserSearchValue($search)
    {

        if (stripos($search, ';') || stripos($search, ':')) {
            $values = explode(';', $search);
            foreach ($values as $value) {
                $s = explode(':', $value);
                if (count($s) == 1) {
                    return $s[0];
                }
            }

            return null;
        }

        return $search;
    }
841114
public function forceCharset($string, $encoding)
    {
        if ($this->isCharset($string, $encoding)) {
            return;
        }

        $e = (new InvalidCharsetException($string, $encoding))->useGuard($this);

        throw $e;
    }
827219
public static function padRight(
        $string,
        $length = 0,
        $substring = ' ',
        $encoding = null
    ) {
        $encoding = $encoding === null ? mb_internal_encoding() : $encoding;

        return static::doPad($string, 0, $length - Mbstring::strlen($string, $encoding), $substring, $encoding);
    }
215480
public static function contains(
        $string,
        $search,
        $caseSensitive = true,
        $encoding = null
    ) {
        $encoding = $encoding === null ? mb_internal_encoding() : $encoding;

        if ($caseSensitive) {
            return Mbstring::strpos($string, $search, 0, $encoding) !== false;
        } else {
            return Mbstring::stripos($string, $search, 0, $encoding) !== false;
        }
    }