venus – 20-30 Aug 16

Hey. How can I split the string , so it won't throw any empty strings?
"First\nSecond\nThird\n\nFourth".split(`\n`);

["First", "Second", "Third", "", "Fourth"]; // Remove empty string
"First\nSecond\nThird\n\nFourth".split(`\n`);

["First", "Second", "Third", "", "Fourth"]; // Remove empty string
UU
Unknown User609d ago
V
venus609d ago
I knew I can do it somehow using regex, but don't know the syntax. Thank you.
UU
Unknown User609d ago
V
venus609d ago
this string is returned from an API, so I am unable to edit it, if you meant it that way
UU
Unknown User609d ago
V
venus609d ago
Oh yea Thanks for the tip.
G
ghardin137609d ago
alternatively you can just filter the resulting array
UU
Unknown User609d ago