Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Possible Duplicate:
How do I split this string with javascript?

I want to split comma separated string in javascript.

share|improve this question
and many more duplicates.. – Shadow Wizard Mar 11 '11 at 6:59
and many identical answers in the same minute ;) – mplungjan Mar 11 '11 at 7:03
add comment (requires an account with 50 reputation)

marked as duplicate by Shadow Wizard, KooiInc, mplungjan, alex, Kyle Rozendo Mar 11 '11 at 7:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4 Answers

var partsOfStr = str.split(',');

split()

share|improve this answer
2  
This website has saved me soo many hours of programming! Thank you Alex :) – Mr. White Sep 7 '12 at 21:07
add comment (requires an account with 50 reputation)
var array = string.split(',')

and good morning, too, since I have to type 30 chars ...

share|improve this answer
   
Clever! And good afternoon, too, since I have to type 15 chars ... – rinogo Dec 15 '12 at 18:45
add comment (requires an account with 50 reputation)
"1,2,3".split(",") // ["1", "2", "3"]
share|improve this answer
add comment (requires an account with 50 reputation)

Use

YourCommaSeparatedString.split(',');
share|improve this answer
add comment (requires an account with 50 reputation)

Not the answer you're looking for? Browse other questions tagged or ask your own question.