码客知道 码客知道 Logo
  • PHP
  • Java
  • JavaScript
  • Golang
  • 在线工具
  • 隐私政策
  • Light
  • Dark
  • System
登 录
PHP Java JavaScript Golang 在线工具 隐私政策
  1. 码客知道
  2. PHP
  3. php通过大写字母分割字符串

Table Of Contents

骑驴找蚂蚁
骑驴找蚂蚁

全干工程师

2018/01/11 17:52

php通过大写字母分割字符串

使用preg_split和表达工[A-Z]来分割:

function splitAtUpperCase($s) {
    return preg_split('/(?=[A-Z])/', $s, -1, PREG_SPLIT_NO_EMPTY);
}

使用preg_replace替换:

preg_replace('/(?<!^)([A-Z])/', '-\\1', $param);

 

骑驴找蚂蚁 最受欢迎程序解答

  • 1

    从零开始编写一个Chrome插件

  • 2

    An SSL certificate error occurred when fetching the script

  • 3

    go自定义tcp消息通信

  • 像素转rem对照表

  • angular2入门教程之Json动态表单创建

  • Golang获取零点时间戳最佳方法

  • 使用Go列出文件夹中的文件

  • PHP8之属性注解(Attributes)

  • mysql JSON更新、插入、查询语法的最佳实践

  • Golang gRPC入门实践指南

最受欢迎程序解答

  • 1

    从零开始编写一个Chrome插件

  • 2

    An SSL certificate error occurred when fetching the script

  • 3

    Docker Volume入门用法详解

  • Docker Network入门用法

  • go自定义tcp消息通信

  • 像素转rem对照表

  • Golang获取零点时间戳最佳方法

  • 使用Go列出文件夹中的文件

  • PHP8之属性注解(Attributes)

  • mysql JSON更新、插入、查询语法的最佳实践

上一篇: Symfony事件调度器的使用 下一篇: Flutter中CupertinoNavigationBar控件背景透明化

留言

© 2025 Powered By OctopusPress™. All Rights Reserved.

程序解答 Angular问题解答 Golang问题解答 Docker问题解答 浙ICP备17018093号-2