Applies delimiter formatting to a string

@param string $string    The original string
@param string $delimiter The delimiter

@return string
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);
    }
535741
private static function isDelimiter($char, array $delimiters = null)
    {
        if (null === $delimiters) {
            return \ctype_space($char);
        }

        foreach ($delimiters as $delimiter) {
            if ($char === $delimiter) {
                return true;
            }
        }

        return false;
    }
1199318
private function processParams($uri, $delimiter = ':')
    {
        if (strpos($uri, $delimiter) !== false) {
            preg_match_all(static::paramsRegex(), $uri, $matches, PREG_SET_ORDER);

            foreach ($matches as $match) {
                $param = explode($delimiter, $match[1]);
                if (count($param) === 2) {
                    $plain_var = filter_var($param[1], FILTER_SANITIZE_STRING);
                    $this->params[$param[0]] = $plain_var;
                    $uri = str_replace($match[0], '', $uri);
                }
            }
        }
        return $uri;
    }
1751
public function innerHtml($delimiter = '')
    {
        $innerHtml = [];

        foreach ($this->node->childNodes as $childNode) {
            $innerHtml[] = $childNode->ownerDocument->saveHTML($childNode);
        }

        return implode($delimiter, $innerHtml);
    }
59812
public static function multiExplode($string, array $delimiters, $keepDelimiters = true)
    {
        if ($keepDelimiters === true) {
            // Ensure special characters are escaped
            foreach ($delimiters as &$delimiter) {
                $delimiter = preg_quote($delimiter);
            }

            // RegEx fragment with delimiters
            $fragment = implode('|', $delimiters);
            $regEx = sprintf('@(?<=%s)@', $fragment);
            return preg_split($regEx, $string, -1, PREG_SPLIT_DELIM_CAPTURE);

        } else {

            $string = str_replace($delimiters, $delimiters[0], $string);
            return explode($delimiters[0], $string);
        }
    }
1306222
public static function slugify($str, $delimiter = '-')
    {
        $temp = preg_replace(
            '/[^a-z0-9]/',
            $delimiter,
            strtolower(trim(strip_tags($str)))
        );

        return preg_replace('/-{2,}/', $delimiter, $temp);
    }
974687
public function recvLine($delimiter = "\n") {
        $str = '';
        while (!$this->stream_eof()) {
            $char = $this->recvChr();
            $str .= $char;
            if ($char === false) { return $str; }
            if (strpos($str, $delimiter) !== false) { return $str; }
        }
        return $str;
    }
190730
public static final String escapeString(final String delimiter,
            final String input) {
        final String escaped = escapeString(input);
        if (escaped.isEmpty()) {
            return escaped;
        }
        return delimiter + escaped;
    }
179774
public function toString($delimiter = ' ') {
        $queryFieldString = '';

        foreach ($this->queryFields as $fieldName => $fieldBoost) {
            $queryFieldString .= $fieldName;

            if ($fieldBoost != 1.0) {
                $queryFieldString .= '^' . number_format($fieldBoost, 1, '.', '');
            }

            $queryFieldString .= $delimiter;
        }

        return rtrim($queryFieldString, $delimiter);
    }
496277
public function implode(string $delimiter) : string
    {
        return rtrim($this->fold(function (string $fold, $elem) use ($delimiter) {
            $fold .= A\concat($delimiter, $elem, '');
            return $fold;
        }, '')->getList(), $delimiter);
    }
229155
public function setDelimiter(string $delimiter): self
    {
        if ($delimiter === $this->delimiter) {
            return $this;
        }

        if (1 === strlen($delimiter)) {
            $this->delimiter = $delimiter;
            $this->resetProperties();

            return $this;
        }

        throw new Exception(sprintf('%s() expects delimiter to be a single character %s given', __METHOD__, $delimiter));
    }
1231758
public static function explodeTrim($str, $delimiter = ',')
    {
        if (is_string($delimiter)) {
            $str = trim(preg_replace('|\\s*(?:' . preg_quote($delimiter) . ')\\s*|', $delimiter, $str));
            return explode($delimiter, $str);
        }
        return $str;
    }
1274698
private function getDelimiterRightPosition($string, $offset = 0, $delimiter = ';', $skipInBrackets = false)
    {
        $pos = $this->getDelimiterPos($string, $offset, $delimiter, $skipInBrackets);
        if ($pos === false) {
            return false;
        }

        do {
            $newPos = $this->getDelimiterPos($string, $pos + 1, $delimiter, $skipInBrackets);
            if ($newPos !== false) {
                $pos = $newPos;
            }
        } while ($newPos !== false);

        return $pos;
    }
483704
public function format($string) {
        if ($this->isAnsiEnabled()) {
            return $this->formatAnsi($string);
        }

        return $this->formatPlain($string);
    }
103748
public function capitalizeWords( $delimiter = NULL )
	{
		$oldString		= $this->string;
		if( !$delimiter || preg_match( "/ +/", $delimiter ) ){
			$this->string	= ucwords( $oldString );
			return $this->string !== $oldString;
		}
		else{
			$token			= md5( (string) microtime( TRUE ) );
			$work			= str_replace( " ", "{".$token."}", $oldString );
			$work			= str_replace( $delimiter, " ", $work );
			$work			= ucwords( $work );
			$work			= str_replace( " ", $delimiter, $work );
			$this->string	= str_replace( "{".$token."}", " ", $work );
			return $this->string !== $oldString;
		}
	}
1075754
public function sentence($string, $delimiter = ' ', $option = \PINYIN_NO_TONE)
    {
        if (\is_int($delimiter)) {
            list($option, $delimiter) = array($delimiter, ' ');
        }

        return implode($delimiter, $this->convert($string, $option | \PINYIN_KEEP_PUNCTUATION | \PINYIN_KEEP_ENGLISH | \PINYIN_KEEP_NUMBER));
    }
295374
public void setDelimiter(final String delimiter) {
        String prefix = "";
        //escape the "pipe" character used in regular expression of String.split method
        if ("|".equals(delimiter)) {
            prefix = "\\";
        }
        this.delimiter = prefix + delimiter;
    }