shamsuljewel Posted November 29, 2007 Share Posted November 29, 2007 Hello everyone I can parse word by php using strpos and explode. How can I do this by javascript? suppose I have a string s = "abc&bcd&boddy"; so now I want to parse the words and save in an array[0] = abc array[1]=bcd and array[2] = boddy. so how can i do it? Link to comment https://forums.phpfreaks.com/topic/79382-solved-how-to-parse-the-words/ Share on other sites More sharing options...
shamsuljewel Posted November 29, 2007 Author Share Posted November 29, 2007 oppppsssssss that is so easy.... var mySplitResult = myString.split("&"); var results = new Array(); for(i = 0; i < mySplitResult.length; i++) { results[i] = mySplitResult[i]; //document.write("<br /> Element " + i + " = " + mySplitResult[i]); document.write(results[i]+'<br>'); } Link to comment https://forums.phpfreaks.com/topic/79382-solved-how-to-parse-the-words/#findComment-401865 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.