コード例 #1
0
        private void ProcessLyrics()
        {
            var lines = Lyrics?.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries) ?? new string[0];

            if (lines.Length == 0)
            {
                NumberOfWords = 0;
                return;
            }

            // The lyrics sometimes start with track metadata like the artist, so remove those.
            var linesWithColons = lines.TakeWhile(line => line.Contains(":")).Count();

            Lyrics        = string.Join(Environment.NewLine, lines.Skip(linesWithColons));
            NumberOfWords = Lyrics.Split(new char[0], StringSplitOptions.RemoveEmptyEntries).Length;
        }