Functionize string.

@param string $text
@param string $separator
@return string $functionized
555002
public static function toFunctionFormat($text, $separator = '-')
    {
        $camelized = self::toCamelCaseFormat($text, $separator);

        return lcfirst($camelized);
    }
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);
	}
360424
public function setSeparator($separator)
    {
        if (!in_array(
            $separator,
            [
                ' ',
                '-'
            ],
            true
        )
        ) {
            $separator = ' ';
        }

        $this->separator = $separator;

        return $this;
    }
448398
public static final function fcm(string $string, string $separator = '_'): string {
		return ltrim(preg_replace_callback('/\\\?[A-Z][A-Za-z0-9]+?/', function($Macthes) use ($separator){
			return $separator . ltrim(strtolower($Macthes[0]), '\\');
		}, $string), $separator);
	}
1313810
public static function generateEn($lenght = 4, $separator = ' ')
    {
        $list = new WordList\En();
        return (new static($list))->generate($lenght, $separator);
    }
1024546
public function makeTitle($title, $separator = ' | ')
    {
        if (empty($title)) {
            return $this->getTitle();
        }

        return $title."{$separator}".$this->getTitle();
    }
1101031
public function withSeparator(string $separator): self
    {
        if ($separator === $this->separator) {
            return $this;
        }

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

        return $clone;
    }
478898
public static function getStringElements($string, $separator)
    {
        $matches = [];
        $pattern = sprintf('|[^\%s]+|', $separator);
        $matchCount = preg_match_all($pattern, $string, $matches);

        if ($matchCount > 1) {
            return $matches[0];
        }

        return [];
    }
649864
public static function camelCaseToSeparator($text, $sep = " ")
    {
        if (!is_scalar($text) && !is_array($text)) {
            return $text;
        }
        if (self::hasPcreUnicodeSupport()) {
            $pattern = array(
                '#(?<=(?:\p{Lu}))(\p{Lu}\p{Ll})#',
                '#(?<=(?:\p{Ll}|\p{Nd}))(\p{Lu})#'
            );
            $replacement = array($sep.'\1', $sep.'\1');
        } else {
            $pattern = array(
                '#(?<=(?:[A-Z]))([A-Z]+)([A-Z][a-z])#',
                '#(?<=(?:[a-z0-9]))([A-Z])#');
            $replacement = array('\1'.$sep.'\2', $sep.'\1');
        }
        return preg_replace($pattern, $replacement, $text);
    }
706883
public static function machine($str, $separator = '_')
    {
        $out = strtolower($str);
        $out = preg_replace('/[^a-z0-9' . $separator . ']/', $separator, $out);
        $out = preg_replace('/' . $separator . '{2,}/', $separator, $out);
        $out = preg_replace('/^' . $separator . '/', '', $out);
        $out = preg_replace('/' . $separator . '$/', '', $out);
        return $out;
    }
469819
public function implode($separator = ' : ')
    {
        $m = array_map(
            function (StringType $msg) {
                return $msg();
            },
            $this->messages
        );

        return implode($separator, $m);
    }
202986
public static function transliterate($text, $separator = '-')
    {
        $text = strip_tags($text);
        $text =  GedmoUrlizer::transliterate($text, $separator);
        return $text;
    }
98503
public static function concat(array $array, $separator = ' ')
    {
        $result = '';

        foreach ($array as $string) {
            if (is_string($string)) {
                $result .= $string;
            }
        }

        return $result;
    }
985844
public static function substringBefore($string, $separator)
    {
        $pos = mb_strpos($string, $separator);
        return $pos !== false ? mb_substr($string, 0, $pos) : $string;
    }
859376
public static function implode(string $separator, array $items, ?callable $itemFunction = null): string
    {
        if (is_callable($itemFunction)) {
            foreach ($items as $index => $item) {
                $items[$index] = $itemFunction($item);
            }
        }
        return implode($separator, $items);
    }
286296
public static function getSizePattern($separator = ' x ')
    {
        $escapeMe = [
            '/',
            '|',
            '.',
            '(',
            ')',
            '[',
            ']',
        ];

        $cleanSeparator = trim($separator);

        if (in_array($cleanSeparator, $escapeMe, true)) {
            // I have to escape special character of  regular expression that may be used as separator
            $separator = str_replace($cleanSeparator, '\\' . $cleanSeparator, $separator);
        }

        return sprintf(self::$patterns['size'], $separator);
    }
1060975
public static function toCamelCaseFormat($text, $separator = '-')
    {
        $slugified = self::urlize($text, $separator);
        $camel = strtolower($slugified);
        $camel = ucwords($camel, $separator);

        return str_replace($separator, '', $camel);
    }