Can I read String Builder line by line? And Get the length of each line as well.
EDIT:
“I build string in StringBuilder and add “\n” within. And I need to read it again. I need to consider that every “\n” has a new line.“
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Given your edit, it’s as simple as invoking
toString()on theStringBuilderinstance, and then invokingsplit("\\n")on the returnedStringinstance. And from there, you’ll have aStringarray that you can loop through to access each “line” of theStringBuilderinstance. And of course, invokelength()on eachStringinstance, or “line” to get its length.