Crunz\Utils::splitCamel PHP Method

splitCamel() public static method

Split camel case string
public static splitCamel ( string $text ) : string
$text string
return string
    public static function splitCamel($text)
    {
        $pattern = '/(?<=[a-z])(?=[A-Z])/x';
        $segments = preg_split($pattern, $text);
        return strtolower(join($segments, ' '));
    }

Usage Example

Example #1
0
 public function testSplitCamel()
 {
     $this->assertEquals('thirty seven', Utils::splitCamel('thirtySeven'));
     $this->assertEquals('one thousand and five hundred sixty three', Utils::splitCamel('oneThousandAndFiveHundredSixtyThree'));
     $this->assertEquals('seven hundred eighty five', Utils::splitCamel('sevenHundredEightyFive'));
 }
All Usage Examples Of Crunz\Utils::splitCamel