+3 votes
942 views
in Programming by (2.1k points)
hello guys I want to know how can I remove all line breaks from a string which is coming from a web page dynamically.Thanks For Help.

1 Answer

+1 vote
by (1.9k points)
Hey monika , If you are getting line breaks from a String so you need to replace \n then you have to replace \r, let me see you how with a example
Here we have a text file suppose sample.txt now we have to remove all line breaks from this file. See the Code
 
 String strTextFile = readFileAsString("sample.txt");
strTextFile = strTextFile.replace("\n", "").replace("\r", "");
 
I hope you got my point like the same way you can remove line breaks from your dynamic strings.
 
 
 
 

Not a Member yet?

Ask to Folks Login

My Account

Your feedback is highly appreciated