Java相当于C#的逐字字符串@ [英] Java equivalent of C#'s verbatim strings with @

查看:136
本文介绍了Java相当于C#的逐字字符串@的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

快速提问。是否有相应的@应用于Java中的字符串:

Quick question. Is there an equivalent of @ as applied to strings in Java:

例如我可以做 @c:\ afolder \ afile 在C#中,让它在处理时忽略转义字符而不必执行c:\\\\\\\\\\\\\\\\ 。是否有Java等价物?

For example I can do @"c:\afolder\afile" in C# and have it ignore the escape characters when processing instead of having to do "c:\\afolder\\aFile". Is there a Java equivalent?

hmmm:stackoverflow正在逃避我..哈哈。第二个例子应为:

hmmm: stackoverflow is escaping on me .. lol. The second example should read:

c :(双反斜杠)afolder(双反斜杠)aFile

c:(double-backslash)afolder(double-backslash)aFile

推荐答案

。转义/外化字符串是您唯一的选择。

No. Escaping / externalizing the string is your only choice.

这篇关于Java相当于C#的逐字字符串@的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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