Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

matt http://www.elleandergrey.com

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

create an array or split a long string seperated by tabs newlines carriage returns and commas.

create an array or split a long string seperated by tabs newlines carriage returns and commas.

EG

emails = "skdjf@sdklfj.com sdflj@kj.com sldfj@klj.com, slkj@kjl.com,lskjdf@lkj.com, \r\nlkjkjl@kjk.com"

becomes

=> ["skdjf@sdklfj.com", "sdflj@kj.com", "sldfj@klj.com", "slkj@kjl.comlskjdf@lkj.com", "lkjkjl@kjk.com"]

emails = emails.split(/,/).join().split()
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS