Get text until <!--stop--> or all text.

@param string $text with content

@return string with text
760464
public function getUntilStop($text)
    {
        $pos = stripos($text, "<!--stop-->");
        if ($pos) {
            $text = substr($text, 0, $pos);
        }
        return $text;
    }
638715
public function noSpec($text = "")
    {
        $text = preg_replace("#[" . preg_quote("'`\\|>!`~^<%)(&") . "]#", "", $text);
        $text = str_replace('"', '\"', $text);

        return $text;
    }
1311842
public function prependText($text) {
		$this->owner->PrependedText = $text;
		$this->owner->addExtraClass('form-control');
		return $this->owner;
	}
275231
private function stripContent($text)
    {
        if ($this->convertBrToNewlines()) {
            $text = $this->brToNewline($text);
        }
        if ($this->stripTags()) {
            $text = strip_tags($text);
        }
        return $text;
    }
969929
protected function getNextButton($text = '&raquo;')
    {
        if (!$this->hasMore) {
            return $this->getDisabledTextWrapper($text);
        }

        $url = $this->url($this->currentPage() + 1);

        return $this->getPageLinkWrapper($url, $text);
    }
410493
public function readSex(string $text): string
    {
        $text = strtoupper($text);

        if ($text !== self::SEX_MALE && $text !== self::SEX_FEMALE) {
            $text = self::SEX_UNKNOWN;
        }

        return $text;
    }
741167
private function filter($text)
    {
        $text = preg_replace("/[^&a-z0-9-_\s']/i", '', $text);
        $text = str_replace(' ', $this->separator, $text);
        $text = trim(preg_replace("/{$this->separator}{2,}/", $this->separator, $text), $this->separator);

        return $text;
    }
124890
private function processText($text)
    {
        // verify if content is a string otherwhise just return the original provided content
        if (!is_string($text) || empty($text)) {
            return $text;
        }
        // find all tags based on the REGEX expression
        preg_match_all(static::REGEX, $text, $results, PREG_SET_ORDER);
        // foreach all the results matches the regex
        foreach ($results as $row) {
            // When value is empty (can be caused by using `link[]` we have to skip this item.
            if (empty($row['value'])) {
                continue;
            }
            // extract tag name from regex
            $tag = $row['function'];
            if ($this->hasTag($tag)) {
                $replace = $this->parseTag($tag, $row);
                $text = preg_replace('/'.preg_quote($row[0], '/').'/mi', $replace, $text, 1);
            }
        }
        
        return $text;
    }
543959
protected function splitText($text)
    {
        $punctuations = preg_quote(implode('', $this->punctuations), '/');

        $text = preg_replace('/([^\p{Han}\s'.$punctuations.']+)/u', "\t\t\t$1\t\t", $text);

        $array = [];

        foreach (preg_split('/\t\t/u', $text, -1, PREG_SPLIT_NO_EMPTY) as $item) {
            $array[] = ("\t" === $item[0])
                ? substr($item, 1)
                : preg_split('//u', $item, -1, PREG_SPLIT_NO_EMPTY);
        }

        return $this->flatten($array);
    }
731721
public function waitForText($text, $seconds = null)
    {
        $text = Arr::wrap($text);

        $message = $this->formatTimeOutMessage('Waited %s seconds for text', implode("', '", $text));

        return $this->waitUsing($seconds, 100, function () use ($text) {
            return Str::contains($this->resolver->findOrFail('')->getText(), $text);
        }, $message);
    }
153037
public static function find(string $text) : Header
    {
        $matches = [];
        $parent = new Header();
        if (\preg_match_all(self::HEADERS_REGEX, $text, $matches, PREG_OFFSET_CAPTURE)) {
            foreach ($matches[0] as $index => $match) {
                $parent->append(new Header((int)$match[1], \strlen($match[0]), (int)$matches[1][$index][0], $matches[2][$index][0]));
            }
        }
        return $parent;
    }
128347
public function getSpeechBubble($text)
    {
        $lines = $this->getMessageLines($text);
        $lineLength = $this->getMaxLineLength($lines);
        $text = '';
        $numberOfLines = count($lines);
        $firstLine = str_pad(array_shift($lines), $lineLength);
        if ($numberOfLines === 1) {
            $text = "< {$firstLine} >";
        } else {
            $lastLine = str_pad(array_pop($lines), $lineLength);
            $text = "/ {$firstLine} \\\n";
            foreach ($lines as $line) {
                $line = str_pad($line, $lineLength);
                $text .= "| {$line} |\n";
            }
            $text .= "\\ {$lastLine} /";
        }

        $text = $this->extendBubble($text);
        return $text;
    }
847674
static public function getAllSubStrings($text)
    {
        $splitText = str_split($text);
        $splitCount = count($splitText);
        $subStrings = [];
        for ($i = 0; $i < $splitCount; $i++)
        {
            for ($j = $i; $j < $splitCount; $j++)
            {
                $subStrings[] = implode(array_slice($splitText, $i, $j - $i + 1));
            }
        }
        return $subStrings;
    }
518189
public function purge($text)
    {
        if (!$matches = $this->getMatches($text)) {
            return $text;
        }

        return str_replace($matches, '', $text);
    }
905704
function get_words($text = null)
    {
        if ($text) {
            $matches = $this->check($text);
        }
        else {
            $matches = $this->matches;
            $text    = $this->content;
        }

        $result = array();

        foreach ($matches as $m) {
            $result[] = mb_substr($text, $m[1], $m[2], RCUBE_CHARSET);
        }

        return $result;
    }
331632
public function getUntilMore($text)
    {
        $pos = stripos($text, "<!--more-->");
        $hasMore = $pos;
        if ($pos) {
            $text = substr($text, 0, $pos);
        }
        return [$text, $hasMore];
    }
722957
protected function limitedText($text, $limit = 200)
    {
        $postString = '...';
        $strCount = strlen(trim($text));
        $sLimitedText = $text;

        if($strCount > $limit)
        {
            $sLimitedText = substr($text, 0, $limit) . $postString;
        }

        return $sLimitedText;

    }