var str = "w00123w00456w00789w00234" ;
var arr=str.split('w00');

解决方案 »

  1.   

    没错,splitMETHOD:  String::split --------------------------------------------------------------------------------
    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