AndreaF
AndreaF

Reputation: 12375

String format issue due to new line start

I have a text String, in this form

Lorem ipsum dolor sit amet, 
consectetuer adipiscing elit
, 
lo 
sed diam 
nonummy nibh 
quis 
nostrud exerci.

So looks realy bad when I set the text in a textView.

I need that the String is loaded in this form

Lorem ipsum dolor sit amet, 
consectetuer adipiscing elit, 
lo sed diam nonummy nibh quis 
nostrud exerci.

Filling all the row (when is possible) before start new line.

Since cannot edit all the db entries to adjust the text.

Upvotes: 0

Views: 133

Answers (1)

Silverstorm
Silverstorm

Reputation: 15835

Use this code to remove all new line special characters in the text

yourstring.replaceAll("[\n\r]", "")

Upvotes: 2

Related Questions