javascript - using regular expression to get strings among commas -


i doing javascript coding , have process string array.

the original string this: "red,yellow,blue,green,grey"

what want array this: ["red","yellow","blue","green","grey"]

i have tried write function this, use indexof() position of commas further processing. think it's heavy way. there better way use regular expression or existed javascript method implement purpose?

thanks all.

use string.split function split original string comma.......

string.split(",") 

Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -