Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 530
  • Last Modified:

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
0
Professor
Asked:
Professor
  • 2
1 Solution
 
sajuksCommented:
// 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

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now