以反冲结尾的 Java 属性值
我在 Java .properties 文件中有一个值需要以反冲结束。属性值应该是“\\server\folder\”,我输入的值如下:
name=\\\\server\\folder\\
结尾的反斜杠将杀死下一行出现的任何属性。我是否错误地逃避了这个?
I have a value in a Java .properties file that needs to end in a backlash. The property value should be "\\server\folder\", and I enter the value like so:
name=\\\\server\\folder\\
The trailing backslash is killing whatever property comes on the next line. Am I escaping this incorrectly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定您的情况出现了什么问题,但此代码片段
打印
If
filename.txt
contains请注意,单个(或实际上是奇数)
\属性行末尾的
会转义换行符,事情就会变得混乱。Not sure what the problem is in your case, but this snippet
Prints
If
filename.txt
containsNote that a single (or actually, an odd number) of
\
in the end of a property line would escape the newline character and things gets messed up.