JavaScript split()函数
2014-02-10 21:53
489 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>JavaScript split()函数</title> <script type="text/javascript"> var str = "http://blog.csdn.net/you23hai45/article/details/19048383"; document.write(str.split(".", 2)); document.write("<br>"); document.write(str.split(".")); document.write("<br>"); document.write(str.split("")); document.write("<br>"); document.write(str.split("", 3)); var subStr = "-http-www-blog-"; document.write(subStr.split("-")); var youStr = "you,hai,dong,1,2,3,4,5,6,78,89"; var youStrs = new Array(); youStrs = youStr.split(","); for(var i=0;i<youStrs.length;i++) { document.write(youStrs[i]); document.write("<br>"); } </script> </head> <body> </body> </html>
结果:
http://blog,csdn http://blog,csdn,net/you23hai45/article/details/19048383 h,t,t,p,:,/,/,b,l,o,g,.,c,s,d,n,.,n,e,t,/,y,o,u,2,3,h,a,i,4,5,/,a,r,t,i,c,l,e,/,d,e,t,a,i,l,s,/,1,9,0,4,8,3,8,3 h,t,t,http,www,blog,you hai dong 1 2 3 4 5 6 78 89
相关文章推荐
- 高级语言中函数调用对栈的应用
- 验证身份证Js函数
- UpdateData()函数怎么使用
- Oracle PL/SQL常用函数列表[转载]
- 比较两个字串的函数
- 在Word中插入函数图象
- SQL 字符串去除空格函数
- 函数跟踪
- PHP 中使用 Smarty 之六:Smarty 内建函数
- SQLITE 函数
- (Javascript) 猴子也明白 之 闭包超级入门 4 函数返回函数
- show hide()函数 参数具体对应的毫秒数
- 17周体会函数参数传递
- bitset中的flip()函数
- Delphi常用函数
- 探讨PHP分页导航函数的具体应用
- void * 和 void 在函数返回值中的区别
- 【学习笔记】matlab算法实现贝叶斯判别classify函数
- 线程函数GetExitCodeThread和ExitThread
- [PHP]将回调函数作用到给定数组的单元上