Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
107
rated 0 times [  110] [ 3]  / answers: 1 / hits: 18913  / 15 Years ago, tue, september 29, 2009, 12:00:00

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

More From » string

 Answers
73
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 */

[#98598] Thursday, September 24, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jonmicahm

Total Points: 603
Total Questions: 120
Total Answers: 108

Location: Guam
Member since Fri, Jul 31, 2020
4 Years ago
jonmicahm questions
Sat, Oct 17, 20, 00:00, 4 Years ago
Sun, Apr 12, 20, 00:00, 4 Years ago
Wed, Feb 26, 20, 00:00, 4 Years ago
Sun, Jan 26, 20, 00:00, 4 Years ago
;