Get last part of string based on $separator.

@param string $string
@param string $separator
@return string
515306
public static function last(string $string, string $separator): string
    {
        $string = explode($separator, $string);
        return Arr::last($string);
    }
519536
private function renderTitleLast($separator)
    {
        $output = [];

        if ($this->hasSiteName()) {
            $output[] = $this->getSiteName();
            $output[] = $separator;
        }

        $output[] = $this->getTitleOnly();

        return implode('', $output);
    }
1240846
public function convertToOrd($str, $separator = '-') {
		$chars = preg_split('//', $str, -1);
		$res = [];
		foreach ($chars as $char) {
			//$res[] = UnicodeLib::ord($char);
			$res[] = ord($char);
		}
		return implode($separator, $res);
	}
1134477
public static function getStringWithoutLastElement($string, $separator)
    {
        $elements = self::getStringElements($string, $separator);
        $lastKey = Arrays::getLastKey($elements);

        unset($elements[$lastKey]);

        return implode($separator, $elements);
    }
668161
public static function wrap(string $text, int $length, string $separator = "\n"): string
    {
        if ($text === '' || self::length($text) === $length) {
            return $text;
        }
        $endedWithLinebreak = substr($text, -1) === "\n";
        $text = str_replace("\r", '', $text);
        $text = str_replace("\n", '', $text);
        $text = explode(' ', $text);

        $result = [];
        $lineNo = 0;
        foreach ($text as $word) {
            if (!isset($result[$lineNo])) {
                $result[$lineNo] = '';
            }
            $lastLineNo = count($result) - 1;

            if ((self::length($result[$lastLineNo]) + self::length($word)) >= $length) {
                $lineNo++;
                if (!isset($result[$lineNo])) {
                    $result[$lineNo] = '';
                }
                $lastLineNo = count($result) - 1;
            }

            $result[$lastLineNo] .= $result[$lastLineNo] !== '' ? ' ' : '';
            $result[$lastLineNo] .= $word;
        }

        $text = implode($separator, $result);
        if ($endedWithLinebreak) {
            $text .= "\n";
        }
        return $text;
    }
732063
public function getGeoLocationAsString(string $separator = ';'): string
    {
        return number_format($this->latitude, 6) . $separator . number_format($this->longitude, 6);
    }
144188
public static function concatenate($str, $suffix, $separator)
    {
        if (empty($suffix)) {
            return $str;
        }
        if (empty($str)) {
            return $suffix;
        }

        return $str . $separator . $suffix;
    }
665205
public function getAllowedExtensionsAsHumanString($lastSeparator = null) {
		$separator = ', ';

		$str = \implode($separator, $this->allowedExtensions);
		$str = \strtoupper($str);

		if ($lastSeparator !== null) {
			$lastSeparatorPosition = \strrpos($str, $separator);

			if ($lastSeparatorPosition !== false) {
				$str = \substr_replace($str, $lastSeparator, $lastSeparatorPosition, \strlen($separator));
			}
		}

		return $str;
	}
1076549
public function getStringsBetween($string, $start, $end)
    {
        $lastPos   = 0;
        $positions = array();

        while (($lastPos = strpos($string, $start, $lastPos)) !== false) {
            $positions[] = $lastPos;
            $lastPos     += strlen($start);
        }
        $lastPos      = 0;
        $positionsEnd = array();
        while (($lastPos      = strpos($string, $end, $lastPos)) !== false) {
            $positionsEnd[] = $lastPos;
            $lastPos        += strlen($end);
        }
        $return = [];
        foreach ($positions as $index => $position) {
            $return[] = str_replace([$start, $end], '', substr($string, $position, $positionsEnd[$index] - $position));
        }
        return $return;
    }
216703
public static function suffix( $string, $sep = '-' ) 
	{
		return substr( $string, strrpos( $string, $sep )+strlen( $sep ) );
	}
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);
    }
591297
private function getExcerpt($text, $length = 250, $separator = ' &hellip;')
    {
        // use regex instead of strip_tags to left some spaces when removing tags
        $text = preg_replace('#<[^>]+>#', ' ', $text);

        // trim whitespace at beginning or end of string
        // See: http://stackoverflow.com/a/4167053/569101
        $text = preg_replace('/^[\pZ\pC]+|[\pZ\pC]+$/u', '', $text);
        // clean new lines and tabs
        $text = trim(preg_replace("/[\n\r\t ]+/", ' ', $text), ' ');

        if (mb_strlen($text) > $length) {
            // If breakpoint is on the last word, return the text without separator.
            if (false === ($breakpoint = mb_strpos($text, ' ', $length))) {
                return $text;
            }
            $length = $breakpoint;

            return rtrim(mb_substr($text, 0, $length)) . $separator;
        }

        return $text;
    }
152748
public static String[] splitLongString(String str, char separator)
    {
        int len = (str == null) ? 0 : str.length();
        if (str == null || len == 0)
        {
            return ArrayUtils.EMPTY_STRING_ARRAY;
        }

        int       oldPos = 0;
        ArrayList list = new ArrayList();
        int pos = str.indexOf(separator);
        while(pos >= 0)
        {
            list.add(substring(str, oldPos, pos));
            oldPos = (pos + 1);
            pos = str.indexOf(separator, oldPos);
        }


        list.add(substring(str, oldPos, len));

        return (String[]) list.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
    }
1101031
public function withSeparator(string $separator): self
    {
        if ($separator === $this->separator) {
            return $this;
        }

        $clone = clone $this;
        $clone->separator = $this->filterSeparator($separator);

        return $clone;
    }
166229
public function toString($separator = null)
    {
        if (!is_null($separator)) {
            $this->_separator = $separator;
        }

        $this->_prepareData();
        return $this->__toString();
    }
351883
private function getWords($string)
    {
        $delimiter = $this->get('delimiter');
        if (empty($delimiter)) {
            $delimiter = ' ';
        }

        return trimsplit($delimiter, $string);
    }
84586
public static function slug($string, $separator = '-', array $options = [])
    {
        if (!static::$slugify instanceof Slugify) {
            static::$slugify = Slugify::create($options);
        }

        return mb_strtolower(static::$slugify->slugify($string, $separator));
    }