Count lines in a string with IndexOf