Solved

JS - How do I parse a colon delimited string into an Array?

Posted on 2010-08-25
7
790 Views
Last Modified: 2013-11-08
JS - How do I parse a colon delimited string into an Array?

  var bdlist = '36:24:12:4'; -- this actually comes from database

???????????

  for ( var j=0;j< bdlist.length; j++ ){
      alert(bdlist[j]);
  }
0
Comment
Question by:bcarlis
[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
  • 5
7 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 125 total points
ID: 33526908
use : bdlist = bdlist.split(":")
0
 
LVL 82

Assisted Solution

by:leakim971
leakim971 earned 125 total points
ID: 33526918
bdlist[0] equal 36
bdlist[3] equal 4
0
 
LVL 82

Assisted Solution

by:leakim971
leakim971 earned 125 total points
ID: 33526928
test page :


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<script language="javascript">
	var bdlist = '36:24:12:4'; // -- this actually comes from database
	bdlist = bdlist.split(":");
	for ( var j=0;j< bdlist.length; j++ ){
		alert(bdlist[j]);
	}
</script>
</body>
</html>

Open in new window

0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 33529353
Wow. 3 comments for this? Where do you get the time Leakim?
0
 
LVL 82

Expert Comment

by:leakim971
ID: 33530237
lol... and it's seems, it's not suffisant : the question is still open...
0
 
LVL 2

Author Closing Comment

by:bcarlis
ID: 33531555
You have to give me time to look at it..
:>) I posted before I left work yesterday!

Thank you, my JS is rusty... I remember now..
0
 
LVL 82

Expert Comment

by:leakim971
ID: 33535581
I understand, don't worry about our jokes! Thanks a lot for the points! You're very welcome!
0

Featured Post

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

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

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to dynamically set the form action using jQuery.
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…

717 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