I want to break this string:
data=
1.
Title: The Definitive Guide
Copy: There’s no way around it,
URL: http://www.schools
Date: 6/7/17
2.
Title: Using
Copy: Today’s fast
URL: https://blog
Date: 6/16/17
3.
Title: 4 Ways
Copy: Let’s state
URL: https://www.
Date: 6/20/17
into an array of length=3 in this case (one for each of the numbering above). Each array item should be an object with the properties: title, copy, url, date.
I've tried this:
for(let i=0; i<3; i++) {
arr[i] =temp.split(i+2 + ".");
temp=temp.slice(0, arr[i].length);
};
Perhaps there is a simpler string method even. Could not find something similar looking in past questions published in SO.