When I save file from pop up the path is like this format
C:\Users\Test\Desktop\ed\file001.xml
But to save it I need to use:
StreamResult result = new StreamResult(new File("C:\\Users\\Test\\Desktop\\ed\\file001.xml"))).
I.E. two slash separate between the folder.
Is there a standard way to solve it?
Backslashes need to be escaped in String literals, because they’re a special character. But the String literal
"a\\b"is in fact a String containing a, one backslash, and b. If you print it, it will displaya\b. Just like the String literal"a\nb"is a String containing a, one newline character, and b.You don’t have anything to do.