Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

php explode like function

Posted on 2004-09-10
3
Medium Priority
?
529 Views
Last Modified: 2008-03-03
Hi!

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

Thx in advance
0
Comment
Question by:Professor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 33

Accepted Solution

by:
sajuks earned 200 total points
ID: 12024705
// 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
 

Author Comment

by:Professor
ID: 12024755
Thx very much... :)
0
 
LVL 33

Expert Comment

by:sajuks
ID: 12024857
Thanks for the points and grade
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question