helper public function for fix_case

@param String $separator The separator.
@param String $word The word to check.

@return String
186799
public function safe_ucfirst($separator, $word) {
        // uppercase words split by the separator (ex. dashes or periods)
        $parts = explode($separator,$word);
        foreach ($parts as $word) {
            $words[] = ($this->is_camel_case($word)) ? $word : ucfirst(strtolower($word));
        }
        return implode($separator,$words);
    }
187314
public static function stripSuffix(string $data, string $prefix, string $separator = ''): string
    {
        if ($data === '') {
            return $data;
        }
        if ($separator !== '') {
            $data = rtrim($data, $separator);
        }
        if (static::substr($data, -static::length($prefix)) === $prefix) {
            $data = static::substr($data, 0, -static::length($prefix));
        }
        if ($separator !== '') {
            $data = rtrim($data, $separator);
        }
        return $data;
    }
550531
public function substringBeforeLast($separator)
    {
        if (($offset = $this->indexOfLast($separator)) === false) {
            return false;
        }

        return static::create(mb_substr($this->str, 0, $offset, $this->encoding), $this->encoding);
    }
316066
public static function isSuffixed(string $data, string $suffix, string $separator = ''): bool
    {
        if ($separator !== '') {
            $data = trim($data, $separator);
        }
        return static::substr($data, -static::length($suffix)) === $suffix;
    }
664836
public static function oneByWord($word)
	{
		$word = trim($word);
		$word = strtolower($word);

		return self::blank()
			->whereEquals('word', $word)
			->row();
	}
972777
protected function decamelize($word)
    {
        return preg_replace_callback(
            '/(^|[a-z])([A-Z])/',
            function ($matches) {
                return strtolower(strlen($matches[1]) ? $matches[1] . "_" . $matches[2] : $matches[2]);
            },
            $word
        );
    }
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);
	}
469819
public function implode($separator = ' : ')
    {
        $m = array_map(
            function (StringType $msg) {
                return $msg();
            },
            $this->messages
        );

        return implode($separator, $m);
    }
1360524
public function setSeparator($separator)
    {
        if (!is_string($separator)) {
            throw new Exception\InvalidArgumentException('"' . $separator . '" is not a valid separator.');
        }
        $this->separator = $separator;
        return $this;
    }
985844
public static function substringBefore($string, $separator)
    {
        $pos = mb_strpos($string, $separator);
        return $pos !== false ? mb_substr($string, 0, $pos) : $string;
    }
1291747
static function wordSeparator()
    {
        if ( isset( $GLOBALS['eZCharTransform_wordSeparator'] ) )
        {
            return $GLOBALS['eZCharTransform_wordSeparator'];
        }
        else
        {
            $ini = eZINI::instance();
            $separator = strtolower( $ini->variable( "URLTranslator", "WordSeparator" ) );
            switch ( $separator )
            {
                case 'dash':
                    $separator = '-';
                    break;
                case 'underscore':
                    $separator = '_';
                    break;
                case 'space':
                    $separator = ' ';
                    break;
                default:
                    return '-';
            }
            $GLOBALS['eZCharTransform_wordSeparator'] = $separator;
            return $separator;
        }
    }
1280870
public static function stem($word)
    {
        $word = mb_strtolower($word);
        //check for invalid characters
        preg_match("#.#u", $word);
        if (preg_last_error() !== 0) {
            throw new \InvalidArgumentException("Word '$word' seems to be errornous. Error code from preg_last_error(): " . preg_last_error());
        }
        if (!isset(self::$cache[$word])) {
            $result             = self::getStem($word);
            self::$cache[$word] = $result;
        }

        return self::$cache[$word];
    }
292228
public static String splitCamelCase(String text, String separator) {
        return CAMEL_REGEX.matcher(text).replaceAll(separator);
    }
55811
public static function safe_ucfirst($seperator, $word) {
    # uppercase words split by the seperator (ex. dashes or periods)
    $parts = explode($seperator, $word);
    foreach ($parts as $word) {
      $words[] = (self::is_camel_case($word)) ? $word : ucfirst(strtolower($word));
    }
    return implode($seperator, $words);
  }
55189
public static function removeLast(string $string, string $separator): string
    {
        $string = explode($separator, $string);
        $string = Arr::removeLast($string);
        return implode($separator, $string);
    }
728202
public function findWord($word)
    {
        $key = $this->collator->getSortKey($word);

        /* In intl > 3.0.0a1, the key now ends with a trailing NUL byte.
         * We remove it for backward-compatibility with older releases. */
        if (substr($key, -1) === "\0") {
            $key = substr($key, 0, -1);
        }

        $this->existsQuery->execute(array(':key' => $key));
        $res = $this->existsQuery->fetchColumn();
        $this->existsQuery->closeCursor();
        if ($res === false || $res === null) {
            return null;
        }
        return $res;
    }
159168
public function removeWordDelimiter ($delimiter)
    {
        if (empty($delimiter)) {
            throw new Exception('Word delimiter cannot be null.');
        }
        if (is_array($delimiter)) {
            foreach ($delimiter as $delim) {
                $this->removeWordDelimiter($delim);
            }
        } else {
            if (! in_array($delimiter, $this->getWordDelimiters())) {
                throw new Exception("Word delimiter '$delimiter' is not in delimiters array.");
            }
            $newArray = array();
            foreach ($this->_wordDelimiters as $delim) {
                if ($delim != $delimiter) {
                    $newArray[] = $delim;
                }
                $this->_wordDelimiters = $newArray;
            }
        }
        return $this;
    }