Metnin başındaki ve sonundaki boşlukları temizler. Aradaki boşlukların fazlalıklarını alır.

@param string $string
@param string $charList

@return string
965352
public static function clear($string, $charList = '\s\xA0')
    {
        $string = str_replace('&nbsp;', ' ', $string);

        return trim(preg_replace('@[' . $charList . ']+@u', ' ', $string));
    }
1102834
public function trim($str, $charlist = null)
    {
        return isset($charlist) ? trim($str, $charlist) : trim($str);
    }
535870
public function charset($charset = null)
    {
        if (!func_num_args()) {
            return $this->_charset;
        }
        $this->_charset = $charset ? strtoupper($charset) : null;
        return $this;
    }
735074
public static function _($string, $jsSafe = false)
	{
		$language = AnService::get('anahita:language');
		return $language->_($string, $jsSafe);
	}
569466
public function bBversHTML ($string = '')
    {
                $this->parserBB->setText($string);
                $this->parserBB->parse();
                return $this->parserBB->getParsed();
    }
1176130
public function parseString($string)
    {
        $tokens = new Stack($this->tokenizer->tokenize($string));

        if ($tokens[0]->type === Tokenizer::T_EOF) {
            return new CTX\AccountInfoList();
        }

        $ctx = new CTX();
        $this->reduceStruct($tokens, $ctx);

        return $ctx->accountInfoList[0];
    }
510846
public function ltrim($str, $charlist = null)
    {
        return isset($charlist) ? ltrim($str, $charlist) : ltrim($str);
    }
456194
protected function stringNotEndWith(string $string, string $char){
		return $string[strlen($string)-1]===$char ? substr($string, 0, -1) : $string;
	}
914139
public function escape($string, $charset=null) {

        if (\is_null($charset)){
            $charset = $this['charset'];
        }

        return \htmlspecialchars($string, \ENT_QUOTES, $charset);
    }
114918
public function first($charCount) {
        if($charCount <= 0) {
            return $this->createClone('');
        }

        $newValue = $this->substring(0, (int) $charCount);

        return $this->createClone($newValue);
    }
1088460
private function _getCharset($charset=null)
    {
        if (! $charset) {
            return;
        }

        $expr   = '/^(charset=)(\w+)$/';
        $tokens = array_filter(
            $charset, function ($token) use ($expr) {
                return preg_match($expr, $token, $matches);
            }
        );
        if (count($tokens) > 0) {
            preg_match($expr, array_shift($tokens), $matches);
            $_charset = $matches[2];
        } else {
            $_charset = null;
        }

        return $_charset;
    }
213092
public function setCharList($charList)
    {
        if (! strlen($charList)) {
            $charList = null;
        }

        $this->options['charlist'] = $charList;

        return $this;
    }
1106338
static public function str_cut($string, $length=4, $dot = '', $charset='utf-8')
    {
        return StringHelper::str_cut(DataHelper::filter_html($string), $length, $dot, $charset);
    }
863741
public function escapeJavascript(?string $string, string $charset): string
	{
		if($charset !== 'UTF-8')
		{
			$string = mb_convert_encoding($string, 'UTF-8', $charset);
		}

		$string = preg_replace_callback('/[^a-z0-9,\._]/iSu', [$this, 'javascriptEscaper'], $string);

		if($charset !== 'UTF-8')
		{
			$string = mb_convert_encoding($string, $charset, 'UTF-8');
		}

		return $string;
	}
1011755
public function encodeString(string $string, ?string $charset = 'utf-8', int $firstLineOffset = 0, int $maxLineLength = 0): string
    {
        if ($maxLineLength > 76 || $maxLineLength <= 0) {
            $maxLineLength = 76;
        }

        $thisLineLength = $maxLineLength - $firstLineOffset;

        $lines = [];
        $lNo = 0;
        $lines[$lNo] = '';
        $currentLine = &$lines[$lNo++];
        $size = $lineLen = 0;
        $charStream = new CharacterStream($string, $charset);

        // Fetching more than 4 chars at one is slower, as is fetching fewer bytes
        // Conveniently 4 chars is the UTF-8 safe number since UTF-8 has up to 6
        // bytes per char and (6 * 4 * 3 = 72 chars per line) * =NN is 3 bytes
        while (null !== $bytes = $charStream->readBytes(4)) {
            $enc = $this->encodeByteSequence($bytes, $size);

            $i = strpos($enc, '=0D=0A');
            $newLineLength = $lineLen + (false === $i ? $size : $i);

            if ($currentLine && $newLineLength >= $thisLineLength) {
                $lines[$lNo] = '';
                $currentLine = &$lines[$lNo++];
                $thisLineLength = $maxLineLength;
                $lineLen = 0;
            }

            $currentLine .= $enc;

            if (false === $i) {
                $lineLen += $size;
            } else {
                // 6 is the length of '=0D=0A'.
                $lineLen = $size - strrpos($enc, '=0D=0A') - 6;
            }
        }

        return $this->standardize(implode("=\r\n", $lines));
    }
962161
public function trimLeft($charlist = null)
    {
        return $this->cloneInstance(
            function (StringObject $new) use ($charlist) {
                $new->string = Mbstring::ltrim($new->string, $charlist);
            }
        );
    }
736381
public static function copyValueOf($charList): self
    {
        Assert::typeOf(['string', 'array', __CLASS__], $charList);

        // Convert to native string before creating a new string object
        $string = '';

        if (\is_array($charList)) {
            foreach ($charList as $value) {
                $string .= static::valueOf($value);
            }
        } else {
            $string = (string) $charList;
        }

        return new static($string);
    }