Home > php教程 > php手册 > php 将字符串按大写字母分隔成字符串数组

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

WBOY
Release: 2016-06-06 20:33:33
Original
1799 people have browsed it

php 将字符串按大写字母分隔成字符串数组,需要的朋友可以参考下。

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);
?>

也可以
Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template