public function convertCamelCase($string, $separator = '-'): string
    {
        $string = (string)$string;
        $separator = (string)$separator;

        return strtolower(
            preg_replace(
                '/([a-zA-Z])(?=[A-Z])/',
                '$1' . $separator,
                $string
            )
        );
    }
public function convertCamelCase($string, $separator = '-'): string
    {
        $string = (string)$string;
        $separator = (string)$separator;

        return strtolower(
            preg_replace(
                '/([a-zA-Z])(?=[A-Z])/',
                '$1' . $separator,
                $string
            )
        );
    }
public function convertCamelCase ( $ string , $ separator = '-' ) : string { $ string = ( string ) $ string ; $ separator = ( string ) $ separator ; return strtolower ( preg_replace ( '/([a-zA-Z])(?=[A-Z])/' , '$1' . $ separator , $ string ) ) ; }
Helper to convert `CamelCaseStrings` to `hyphen-case-strings`

Examples:

Carbon.String.convertCamelCase('HelloWorld') == 'hello-world'
Carbon.String.convertCamelCase('HelloWorld', '_') == 'hello_world'
Carbon.String.convertCamelCase('HelloWorld', '') == 'helloworld'

@param string $string    A string
@param string $separator The separator

@return string The converted string
Helper to convert CamelCaseStrings to hyphen - case - strings