One of my reader asked me that many times we need to convert delimited string to Java-script array or vice versa. Delimiter can be comma, pipe etc so how we can do it and use it in a simple way. So today’s post is all about this question and easy to use. Lets take a look into it.
var mynames = new Array("Guddu","Gudia","Gullu");
var nameStr = mynames.join("|");
document.write('With Delimited String :- ' + nameStr);
Now we will split the delimited string which is having | . Wooo did i use split …… yes that is the function which which we are going to use lets check the magic of split().
var nameArray = new Array();
var nameArray = nameStr.split("|");
Hope you like my tutorial if you have any advice or feedback please comment below.
~~~~ HAPPY CODING ~~~~