如何逃脱" \"在Java中的字符 [英] How to escape "\" characters in Java

查看:134
本文介绍了如何逃脱" \"在Java中的字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家都知道,我们可以使用

As we all know,we can use

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

在C#中,为了不加倍'\'。

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

但如何在Java办?

推荐答案

不幸的是,没有完整-STRING在Java中逃脱运营商。您需要编写的代码:

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";

这篇关于如何逃脱" \"在Java中的字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆