php explode like function

Hi!

I am wondering if there is a javascript function like the php explode function www.php.net/function.explode.

Thx in advance
ProfessorAsked:
Who is Participating?
 
sajuksConnect With a Mentor Commented:
// try the splt function
<script>


 var pizza  = 'piece1 piece2 piece3 piece4 piece5 piece6';
pieces = pizza.split(',')[0].split(' ');
for(var i=0; i<pieces.length-1; i++)
{  alert('pizza-> ' +pieces[i]);}


 var str   = 'one|two|three|four'
pieces = str.split(',')[0].split('|');

for(var i=0; i<pieces.length-1; i++)
{  alert('str :' +pieces[i]);}


</script>
0
 
ProfessorAuthor Commented:
Thx very much... :)
0
 
sajuksCommented:
Thanks for the points and grade
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.