0

I have a string containing values which are separated by commas within the string I want to get each value just like I would with PHP explode, but I need to do it in JavaScript. Is there a way and how can be done?

Thanks

Leron

1

2 Answers 2

6

How about:

"some,string,with,commas".split(',')
Sign up to request clarification or add additional context in comments.

Comments

0
var mystring = "I like coffee, very much so, but I don't like...";
var exploded = mystring.split(",");
window.alert(exploded[1]);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.