var str = "w00123w00456w00789w00234" ;
var arr=str.split('w00');
var arr=str.split('w00');
解决方案 »
- 如何用FSO读取js文件
- 如何用js文件做资源文件
- innerhtml的内容怎么进行操作?
- 求一段js正则表达式校验输入格式
- 请教javascript高手:求可以使图片从右往左走的javascript代码,图片要连续不间断,且没有空白……十分感谢
- 求教:如何做出太平洋电脑网这样的边框缩进拉出效果!
- CHINAREN同学录可能有严重漏洞!!
- 如何创建js动态数组 --->>
- 请问怎么提示不得为空??
- 【求助】模板中用jQuery做网站首页幻灯片,怎么样修改幻灯片停留时间??????
- 怎么样使用javascript求阶乘值,但其结果必须在另一个窗口显示!
- javascript生成select下拉選項,為什麼取不到下拉選項的值?
object.split [delimiter]This method is used to 'split' a string into an array of substrings. The array numbering starts at zero.
The optional delimiter argument is the character, regular expression, or substring that is used to determine where to split the string. The delimiter value is not returned as part of the array of substrings.
If the argument is a character or substring, it must be enclosed with in a pair of double quotes. If the argument is a regular expression, do not enclose it with double quotes. If no delimiter argument is provided, the string is not split. If the empty string, "", is used as the delimiter, the string is split between each character in the string.
Code:
myString = new String("A,B,C,D")
splitString = myString.split(",")
document.write("<BR>" + splitString[0])
document.write("<BR>" + splitString[1])
document.write("<BR>" + splitString[2])
document.write("<BR>" + splitString[3])
Output:
A
B
C
D