So I fetch a string from a website via code from another question I posted here. This works really well when I put it into a rich textbox, but, now I need to split the string into seperate sentences in a list/array (suppose list will be easier, since you don't need to determine how long the input is going to be).
Yesterday I found the following code at another question (didn't note the question, sorry):
List<string> list = new List<string>(Regex.Split(lyrics, Environment.NewLine));
But the input is now spliting into two parts, the first three sentences and the rest.
I retrieve the text from musixmatch.com
with the following code (added fixed url for simplicity):
var source = "https://www.musixmatch.com/lyrics/Krewella/Alive";
var htmlWeb = new HtmlWeb();
var documentNode = htmlWeb.Load(source).DocumentNode;
var findclasses = documentNode
.Descendants("p")
.Where(d => d.Attributes["class"]?.Value.Contains("mxm-lyrics__content") == true);
var text = string.Join(Environment.NewLine, findclasses.Select(x => x.InnerText));
More information about this code can be found here. What it does in a nutshell is it retrieves specific html that has the lyrics in it. I need to split the lyrics line by line for a synchronization process that I'm building (just like was built-in in Spotify a while ago). I need something (preferably an list/array) that I can index because that would make the database to store all this data a bit smaller. What am I supposed to use for this process?
Edit: Answer to the mark of a possible duplicate: C# Splitting retrieved string to list/array
mxm-lyrics__content
– nik0lai Dec 15 '16 at 13:03