【发布时间】:2014-07-25 08:14:35
【问题描述】:
$str="Hello MotoBell RingsKing Speech";
如果前面有小写字母,我需要用大写字母分解这个字符串。
像这样:
$splitted=array(
0=>"Hello Moto",
1=>"Bell Rings",
2=>"King Speech"
);
有什么想法吗?
我尝试使用该 reg_ex,但不起作用:
$pieces = preg_split('/(?=[A-ZА-Я])/u', $str, -1, PREG_SPLIT_NO_EMPTY);
【问题讨论】:
-
使用正则表达式,卢克!
-
你能举个例子吗?