Tricky string transformation (hopefully) in LINQ
Posted
by Larsenal
on Stack Overflow
See other posts from Stack Overflow
or by Larsenal
Published on 2010-03-21T03:37:18Z
Indexed on
2010/03/21
3:41 UTC
Read the original article
Hit count: 385
I'm hoping for a concise way to perform the following transformation. I want to transform song lyrics. The input will look something like this:
Verse 1 lyrics line 1
Verse 1 lyrics line 2
Verse 1 lyrics line 3
Verse 1 lyrics line 4
Verse 2 lyrics line 1
Verse 2 lyrics line 2
Verse 2 lyrics line 3
Verse 2 lyrics line 4
And I want to transform them so the first line of each verse is grouped together as in:
Verse 1 lyrics line 1
Verse 2 lyrics line 1
Verse 1 lyrics line 2
Verse 2 lyrics line 2
Verse 1 lyrics line 3
Verse 2 lyrics line 3
Verse 1 lyrics line 4
Verse 2 lyrics line 4
Lyrics will obviously be unknown, but the blank line marks a division between verses in the input.
© Stack Overflow or respective owner