A String looks like this : " I am seal \n\n \t where are we? "
. and the printed version
I am seal
where are we?
I want to make the string like : "I am seal\nwhere are we?"
I am seal
where are we?
I am removing the new line with "[\r\n]+", "\n"
this regex but the problem is when I am trying to remove the white space it also remove the newline. I have used StringUtils
from Apache-common
.
update
Also white space from the beginning of a line also be removed. It should not be consecutive.
How can I achieve this in Java ?
Thank you.