I have a string with multiple lines and I want to read a specific line and save it to an other string. That’s my code
String text ="example text line\n
example text line\n
example text line\n
example text line\n
example text line\n
example text line\n
example text line\n";
String textline1="";
String textline2="";
on the above strings textline1 and textline2 I want to save the specific line.
You can split on the new-line character:
//To split on the new line
//To read 1st line
//To read 2nd line