-1

I have table movies with column description. Text in that column is saved in this format:

This is movie about....

The best scene is...

and when i want to show that text in textarea on GUI there was an error because it coulnd show properly this format. It works great when the format in column is like this:

This is movie about.... \n The best scene is...

then it show it properly in textarea and everything works great. I've tried this:

bean.setDescription(movie.getDescription().replaceAll("\r\n", "\n"));

but it doesn't work, it still put multiple line text to bean. Does anyone know how can i this mulptiple line text convert to single line text and add \n?

hnefatl
  • 5,860
  • 2
  • 27
  • 49
javax
  • 1
  • 1
  • 1
    Welcome to Stack Overflow! Please review our [SO Question Checklist](http://meta.stackoverflow.com/questions/260648/stack-overflow-question-checklist) to help you to ask a good question, and thus get a good answer. Please [edit] your question accordingly. – Joe C Apr 22 '18 at 20:16
  • Possible duplicate of [How to remove line breaks from a file in Java?](https://stackoverflow.com/questions/2163045/how-to-remove-line-breaks-from-a-file-in-java) – Evgeny Kochergin Apr 22 '18 at 21:38

1 Answers1

0

replaceAll expects a regular expression as the first input, let's try a following:

bean.setDescription(movie.getDescription().replaceAll("\\r|\\n", " "));