How to split a string in JavaScript with the ",
" as seperator?
Asked
Active
Viewed 341 times
1
3 Answers
0
var expression = "h,e,l,l,o";
var tokens = expression.split("\,");
alert(tokens[0]);// will return h

Ravi Vanapalli
- 9,805
- 3
- 33
- 43
-
why are you splitting on `\,`? Is that just a typo? – Matt Ellen Feb 04 '10 at 17:39