How to split a string in JavaScript with the "," as seperator?
Asked
Active
Viewed 332 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,489
- 3
- 30
- 41
-
why are you splitting on `\,`? Is that just a typo? – Matt Ellen Feb 04 '10 at 17:39