Suppose the string has three blank lines after an open brace:
"{\r\n\r\n\r\n\r\n"
The first iteration would produce this:
"{\r\n\r\n\r\n"
The second would produce this:
"{\r\n\r\n"
And the third would produce:
"{\r\n"
Each iteration removes a single blank line.