how to split a string in javascript

javascript, string

Solution

var str1 = "When I say wall I want to split";
var chunks = str1.split("wall");

alert(chunks[0]); /* When I say */
alert(chunks[1]); /* I want to split */

Problem

Possible Duplicate: How do I split this string with JavaScript? how to split a string in javascript? example `str = "this is part 1 one wall this is part 2 "` now I want to split the str in 2 parts separated by word `wall` so I want output to be: ``` st1 ="this is part 1 " st2 ="this is part 2 " ```

Original source

Related problems