format函数
来源:互联网 发布:网络推广付费平台 编辑:程序博客网 时间:2024/05/17 06:34
format函数实现自动替换字符串中占位变量,避免使用加号连接字符串。
<script type="text/javascript">String.prototype.format=function(){ if(arguments.length==0) return this; for(var s=this, i=0; i<arguments.length; i++) s=s.replace(new RegExp("\\{"+i+"\\}","g"), arguments[i]); return s;};alert("http://{0}/{1}/{2}".format("www.meizz.com", "web", "abc.htm"));alert("请输入{0},输完后再按存盘按钮".format("姓名"));</script>
- Format函数
- format函数
- Format函数
- Format 函数
- format函数
- Format函数
- Format 函数
- Format函数
- format函数
- format函数
- Format函数
- format函数
- Format函数
- 格式化函数Format
- DELPHI 中的 Format 函数
- vb: format函数问题
- format函数的使用
- format函数的使用
- 标准c++的时间函数
- 【转载】Linux中bash与sh的区别
- Berkeley DB
- 图解--Struts1框架
- Linux 信号通信
- format函数
- 软件能力,教的会吗?
- Android基本组件02(TextView)
- 这些年做项目带新人的经验总结
- 嵌入式系统开发人员的知识结构
- Android特色开发之桌面组件
- 搜索
- org.hibernate.exception.ConstraintViolationException: could not insert
- linux gdb 调试多线程 单独调试线程