如何在javascript中拆分字符串

use*_*785 5 javascript string

可能重复:
如何使用JavaScript拆分此字符串?

如何在javascript中拆分字符串?

例如,str = "this is part 1 one wall this is part 2 "
我想将str分成2个用word分隔的部分wall

所以我希望输出为:

st1 ="this is part 1 "
st2 ="this is part 2 "
Run Code Online (Sandbox Code Playgroud)

Sam*_*son 15

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 */
Run Code Online (Sandbox Code Playgroud)