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

java - BeanIO write annotated class to fixedlength -

Using Java 8 lambdas/transformations to combine and flatten two Maps -

How to connect android app to App engine -