I need to convert a string of words separated by new lines into an array called "words."
aa
aaa
aaaa
aaaaa
In Java, I would do it like this:
String s = "This is a sample sentence.";
String[] words = s.split("\\s+");
for (int i = 0; i < words.length; i++) {
words[i] = words[i].replaceAll("[^\\w]", "");
}
But I'm struggling to figure out how to achieve the same in Ionic 2.