How to escape “\” characters in Java

后端 未结 5 470
说谎
说谎 2020-12-11 06:31

As we all know,we can use

string aa=@\"E:\\dev_workspace1\\AccessCore\\WebRoot\\DataFile\" 

in c# in order not to double the \'\\\'.

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-11 07:22

    Unfortunately, there is no full-string escape operator in Java. You need to write the code as:

    String aa = "E:\\dev_workspace1\\AccessCore\\WebRoot\\DataFile";
    

提交回复
热议问题