Using JavaScript's split to chop up a string and put it in two arrays
Posted
by Pieter
on Stack Overflow
See other posts from Stack Overflow
or by Pieter
Published on 2010-04-23T17:34:48Z
Indexed on
2010/04/23
17:43 UTC
Read the original article
Hit count: 293
JavaScript
|html
I can use JavaScript's split
to put a comma-separated list of items in an array:
var mystring = "a,b,c,d,e";
var myarray = mystring.split(",");
What I have in mind is a little more complicated. I have this dictionary-esque string:
myvalue=0;othervalue=1;anothervalue=0;
How do I split this so that the keys end up in one array and the values end up in another array?
© Stack Overflow or respective owner