Returns the string following the given delimiter

@param string $delimiter

@throws SubstringException If the string is not found

@return self
545181
public function str(string $delimiter): self
    {
        $sub = \mb_strstr($this->value, $delimiter, false, (string) $this->encoding());

        if ($sub === false) {
            throw new SubstringException(\sprintf(
                'Substring "%s" not found',
                $delimiter
            ));
        }

        return new self($sub, $this->encoding);
    }
1006450
public String nextTo(String delimiters) throws JSONException {
		char c;
		StringBuilder sb = new StringBuilder();
		for (;;) {
			c = this.next();
			if (delimiters.indexOf(c) >= 0 || c == 0 || c == '\n' || c == '\r') {
				if (c != 0) {
					this.back();
				}
				return sb.toString().trim();
			}
			sb.append(c);
		}
	}
283855
private function explode($string, $delimiter)
    {
        $result = [];
        while (($pos = strrpos($string, $delimiter)) !== false) {
            $result[] = ($string = substr($string, 0, $pos));
        }
        return $result;
    }
86178
public function substringAfterFirst($separator)
    {
        if (($offset = $this->indexOf($separator)) === false) {
            return false;
        }

        return static::create(mb_substr($this->str, $offset + mb_strlen($separator, $this->encoding), null, $this->encoding), $this->encoding);
    }
472146
public function addWordDelimiter($delimiter)
    {
        if (in_array($delimiter, $this->getWordDelimiters())) {
            throw new \Exception("Word delimiter '$delimiter' is already there.");
        }
        if (empty($delimiter)) {
            throw new \Exception('Word delimiter cannot be null.');
        }
        if (is_array($delimiter)) {
            $this->_wordDelimiters = array_merge($this->getWordDelimiters(), $delimiter);
        } else {
            $this->_wordDelimiters[] = $delimiter;
        }
        return $this;
    }
360804
public function substr($start = 0, $length = null)
    {
        $function = static::$functions[(int) static::$useMbstring]['substr'];

        return new self($function($this->string, $start, $length));
    }
29469
public String text(String delimiter)
    {
        if (delimiter == null) delimiter = "";
        StringBuilder sb = new StringBuilder(size() * 3);
        for (IWord word : this)
        {
            if (word instanceof CompoundWord)
            {
                for (Word child : ((CompoundWord) word).innerList)
                {
                    sb.append(child.getValue()).append(delimiter);
                }
            }
            else
            {
                sb.append(word.getValue()).append(delimiter);
            }
        }
        sb.setLength(sb.length() - delimiter.length());

        return sb.toString();
    }
581042
public function consumeString($delimiter, $type)
    {
        $close = Utils::balanceDelimiter($delimiter);

        $balanced = $close !== $delimiter;
        $patterns = array('/(?<!\\\\)((?:\\\\\\\\)*)(' . preg_quote($close, '/') . ')/');

        if ($balanced) {
            $patterns[] = '/(?<!\\\\)((?:\\\\\\\\)*)(' . preg_quote($delimiter, '/') . ')/';
        }

        $stack = 1; // we're already inside the string
        $start = $this->pos();
        $closeDelimiterMatch = null;
        while ($stack) {
            $next = $this->getNext($patterns);
            if ($next[0] === -1) {
                $this->terminate();
                $finish = $this->pos();
                break;
            } elseif ($balanced && $next[1][2] === $delimiter) {
                $stack++;
                $finish = $next[0] + strlen($next[1][0]);
            } elseif ($next[1][2] === $close) {
                $stack--;
                if (!$stack) {
                    $closeDelimiterMatch = $next[1][2];
                }
                $finish = $next[0] + strlen($next[1][1]);
            } else {
                assert(0);
            }
            $this->pos($next[0] + strlen($next[1][0]));
        }
        $substr = substr($this->string(), $start, $finish - $start);
        // special case for qw, the string is not a 'STRING', it is actually
        // a whitespace separated list of strings. So we need to split it and
        // record them separately
        if ($type === 'SPLIT_STRING') {
            foreach (preg_split('/(\s+)/', $substr, -1, PREG_SPLIT_DELIM_CAPTURE) as $token) {
                if (preg_match('/^\s/', $token)) {
                    $this->record($token, null);
                } else {
                    $this->record($token, 'STRING');
                }
            }
        } else {
            $this->record($substr, $type);
        }
        if ($closeDelimiterMatch !== null) {
            $this->record($closeDelimiterMatch, 'DELIMITER');
        }
    }
247525
public function readString($delim = "\x00")
    {

        // Get position of delimiter
        $len = strpos($this->data, $delim, min($this->index, $this->length));

        // If it is not found then return whole buffer
        if ($len === false) {
            return $this->read(strlen($this->data) - $this->index);
        }

        // Read the string and remove the delimiter
        $string = $this->read($len - $this->index);
        ++$this->index;

        return $string;
    }
1034902
public function explode(string $delimiter, int $limit = PHP_INT_MAX): TextVector
    {
        $pieces = explode($delimiter, $this->text, $limit);

        return TextVector::make($pieces);
    }
185419
private static function delimitString(string $string, string $delimiter): string
    {
        $output = [];

        if (preg_match('/\A[a-z0-9]+\z/ui', $string) && strtoupper($string) !== $string) {
            $parts = self::explodeOnCaps($string);
        } else {
            $parts = self::explodeOnDelims($string);
        }

        foreach ($parts as $part) {
            $output[] = $part.$delimiter;
        }

        return rtrim(implode('', $output), $delimiter);
    }
317659
public function pregQuote(string $delimiter = ''): self
    {
        return new self(\preg_quote((string) $this, $delimiter), $this->encoding);
    }
849031
public function toSnake($delimiter = '_')
    {
        $hash = md5($this->contents) . $delimiter;

        if (isset(static::$snakeCache[$hash])) {
            return new static(static::$snakeCache[$hash], $this->encoding);
        }

        $value = $this->contents;

        if (!mb_ctype_lower($value, $this->encoding)) {
            // Set the target encoding.
            $previous = mb_regex_encoding();
            mb_regex_encoding($this->encoding);

            $value = mb_strtolower(preg_replace(
                '/(.)(?=[A-Z])/u',
                '$1' . $delimiter,
                $value
            ),
                $this->encoding);

            // Restore the previous encoding.
            mb_regex_encoding($previous);
        }

        return new static(
            static::$snakeCache[$value . $delimiter] = $value,
            $this->encoding
        );
    }
763815
public function getTitledItem(string $str, string $item = null, string $delimiter = ';'): string
    {
        return (null === $item)
            ? trim(substr(trim(substr($str, 0)), 0, $this->getStringPositionX(trim(substr($str, 0)), $delimiter, 1)))
            : trim(substr(trim(substr($str, $this->getStringPositionX($str, $item, 1) + strlen($item))), 0, $this->getStringPositionX(trim(substr($str, $this->getStringPositionX($str, $item, 1) + strlen($item))), $delimiter, 1)));
    }
844669
public static String removeLeadingDelimiter(String str, String delimiter) {
        if (!str.startsWith(delimiter)) {
            return str;
        } else {
            return str.substring(delimiter.length(), str.length());
        }
    }
1082459
public static List<String> split(String string, String delimiter) {
        return split(string, delimiter, true);
    }
807145
public function explode($delimiter)
    {
        return func_num_args() === 1 ?
            new JArray(explode($delimiter, $this->subject)) :
            new JArray(explode($delimiter, $this->subject, func_get_arg(1)));
    }