I have some large text data in a string.
The data comes from a file, the line separator is CRLF.
It hold several houndred lines.
Let's assume 10MB data.

From a certain line I need to get the data, then modify it.
The modified data can be shorter or longer than the unmodified data.

Up to now I split the data by CRLF, modify the line, and join it afterwards.
Easy and reliable.
And slow.
And uses more memory than wanted.

I think there should be a better method without split etc.

My idea is to find the xth CRLF and the xth+1 CRLF in the whole large string.
This is also not efficient, as I have to compare every single character to find CRLF.

In short:
I look for a better idea.