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
Post a Comment