I have a string of csv data. For some fields, the data has
n char in it which is disrupting the csv file. I want to keep that
n char in the data without creating a new line. Is there some way to escape the creation of a new line and keeping the char as well in java. A sample would be ->
Now when I will open this csv file in a csv viewer there will be a new line there. I can’t remove the
n char and replace it with "". So is there some way to keep it and escape the functionality of
n char in java?
n a newline character. To use it as a normal statement you may use it as "\n". to say:
Answered by Anushka on August 12, 2020
Try to put one more backslash. Like
Answered by Radek on August 12, 2020
n is special. It is an escape sequence that stands for a newline.
You need to escape it in a string literal in order for it to be actually interpreted the way you want. Append a before it so it looks like this:
Answered by AdilOoze on August 12, 2020
Get help from others!