[JS]转换驼峰命名
来源:互联网 发布:Apache set cookie 编辑:程序博客网 时间:2024/05/16 06:49
29 转换驼峰命名
要求:
函数接受一个字符串作为参数,可以把类似于 is_good_name 这样的变量名替换成 isGoodName。变量名首尾的下划线不需要做处理,中间的下划线全部删除并且处理成驼峰。
const toCamelCaseVar = (variable) =>{ let reg=/_+(\w)/g; let str=variable.replace(reg,function(){ if(arguments[2])return (arguments[1]).toUpperCase(); else return arguments[0]; }); return str;}
阅读全文
0 0
- [JS]转换驼峰命名
- js驼峰命名和下划线转换
- js字符串驼峰命名
- java,下划线与驼峰命名转换
- mybatis中mapUnderscoreToCamelCase自动驼峰命名转换
- 字符串的下划线命名和驼峰命名转换
- 字符串的下划线命名和驼峰命名转换
- js 将用连接符连接的英文字符串转换成驼峰命名的三种方法
- 驼峰命名法camelCase和连字符Hyphenate 相互转换
- 驼峰命名法(camelCase)
- Java 驼峰式命名!
- 驼峰法命名
- 驼峰命名法
- 驼峰式命名法则
- 驼峰命名法总结
- 驼峰式命名法
- 驼峰式命名法
- 驼峰命名法
- Python在测试中的用途
- On my arrival at the Casa Angello I found no one there but Bianca, who was
- hdu 1358
- 第三方登录 (微博登录 web)
- [Kafka]
- [JS]转换驼峰命名
- 分答项目_知识点:分答微信h5支付
- 自定义view实现半圆环
- (论文阅读)Deeper Depth Prediction with Fully Convolutional Residual Networks
- Spring学习之(一)思维导图
- ubuntu更新Debug:E: Some index files failed to download, they have been ignored, or old ones used inst
- 抠图练习
- 让我怎能过大年
- 【OpenCV】OpenCV+VS2015环境配置