我希望通过Case Sensitivity将字符串拆分为数组。像
$str = 'CreateTechBook'
转换为
array('Create','Tech', 'Book')
答案 0 :(得分:4)
function splitCamelCase($str) {
return preg_split('/(?<=\\w)(?=[A-Z])/', $str);
}
答案 1 :(得分:0)
preg_replace('/([a-z0-9])?([A-Z])/','$1 $2 $3',$string);