Obfuscate text and preserve line breaks Problem

A function is needed, that obfuscates text but preserves line breaks. Line breaks may be encoded by "\r\n" or "\r", even mixed. myObfuscator is an object that obfuscates text, ignoring line breaks (would be replaced by any other character).

Example: 


  ABC\r\nDEF\rGHE


should be obfuscated to something like 


  XXX\r\nXXX\rXXX


where XXX depends on myObfuscator (not important for the question).

Implementation

My approach works, but seems a little too complicated.

public string Obfuscate(string text)
{
    var stringBuilder = new StringBuilder();
    var lineCount = 0;
    var lines = text.Split(new[] { "\r\n" }, StringSplitOptions.None);
    foreach (var line in lines)
    {
        var innerLineCount = 0;
        if (lineCount &gt; 0) stringBuilder.Append("\r\n");
        foreach (var innerLine in line.Split(new[] { "\r" }, StringSplitOptions.None))
        {
            if (innerLineCount &gt; 0) stringBuilder.Append("\r");
            var obfuscatedLine = string.IsNullOrEmpty(innerLine) ? string.Empty : myObfuscator.Obfuscate(innerLine);
            stringBuilder.Append(obfuscatedLine);
            innerLineCount++;
        }
        lineCount++;
    }
    return stringBuilder.ToString();
}


Is there a more elegant solution?
I would omit the StringBuilder here and would go with string.Join() by joining the processed innerLines and the processed lines like so  

public string Obfuscate(string text)
{

    var lines = text.Split(new[] { "\r\n" }, StringSplitOptions.None);

    for (int i = 0; i &lt; lines.Length; i++)
    {

        var innerLines = lines[i].Split(new[] { "\r" }, StringSplitOptions.None);
        for (int j = 0; j &lt; innerLines.Length; j++)
        {
            innerLines[j]= string.IsNullOrEmpty(innerLines[j]) ? string.Empty : myObfuscator.Obfuscate(innerLines[j]);
        }

        lines[i] = string.Join("\r", innerLines);

    }
    return string.Join(Environment.NewLine, lines);

}  


What I would add about your code would be some proper argument validation because the method is public. In addition I would move the check wether ther innerLine is NullOrEmpty inside the obfuscator.