Escaping string path

I have the following string that gives me error (replaced some with “abc” for privacy)

String dir = "D:\OneDrive - Abc abc abc abc \ABC\processing-3.0.1\abc\CsvPaddingAutomator";

Not expecting symbol 'O', which is LATIN CAPITAL LETTER O.

how can I escape it correctly?

1 Like

Simply use \\ for this case.
This would mean in this path:

String dir = "D:\\OneDrive - Abc abc abc abc \\ABC\\processing-3.0.1\\abc\\CsvPaddingAutomator";

In case you have no fun with replacing it by hand, you can use Ctrl-F to search \ and replace it by \\.

1 Like