Could it be that each line is being copied to a new string variable (str) on each loop? I'm guissing here, but you could probably verify the theory with this code
String s = String.Empty;
for (int i = 0; i < richTextBox.Lines.Length; i++)
{
string str = richTextBox.Lines[i];
s = str;
}