douzha6055 2014-02-17 14:49
浏览 69
已采纳

php preg_split第一个大写

Using the following code, php explode at capital letters?

you can explode the string by uppercase. But how do you explode it only on the first uppercase? Say you have helloThereMister. I want to get hello ThereMister. I can concatenate the result from the link above, but if there is a way to skip it, then fantastic!

Thanks

  • 写回答

2条回答 默认 最新

  • dqajyxqem115006813 2014-02-17 14:53
    关注

    RTM my friend, as per documentation of preg_split you have also a $limit parameter so the answer is:

    $pieces = preg_split('/(?=[A-Z])/', $str, 1);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?