Home  >  Article  >  Backend Development  >  php 将字符串按大写字母分隔成字符串数组_PHP

php 将字符串按大写字母分隔成字符串数组_PHP

WBOY
WBOYOriginal
2016-06-01 12:20:08864browse

alert("createTechBook".split(/(?=[A-Z])/)) 谢了啊
复制代码 代码如下:
$str="abcDefGhi";
/*
preg_match_all("/([a-zA-Z]{1}[a-z]*)?[^A-Z]/",$str,$array);
*/
$array=preg_split("/(?=[A-Z])/",$str);
print_r($array);
?>


复制代码 代码如下:
$string = "createTechBook";
$arr = preg_split("/(?=[A-Z])/", $string);
print_r($arr);
?>

也可以

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn