can any one let me know if the re is any function in javascript that does the same thing as explode unfciotn in PHP..
thank you
[SOLVED] PHP Explode() equivalent in JavaScript ??
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
more specifically:
Code: Select all
var foo = "weee?~#party";
var bar = foo.split('?');
// bar is an array with elements weee and ~#party
// split also takes RegExp objects (regular expression)
var reg = new RegExp("\?~#","g");
var bar2 = foo.split(reg);
// alternately
var bar3 = foo.split(/\?~#/g);