从ini文件读取路径,反斜杠转义字符消失? [英] Reading path from ini file, backslash escape character disappearing?
问题描述
key = C:\folder\folder2\filename .extension
,存储的值作为 C:folderfolder2filename
有没有人知道如何在之前转义密钥?
我们还假设,更改ini文件的值不是一种替代,因为它不是我创建的文件。
尝试将Ini4j中的escape属性设置为false。
- a href =http://ini4j.sourceforge.net/apidocs/org/ini4j/Config.html#setEscape%28boolean%29 =nofollow> http://ini4j.sourceforge.net/apidocs/org/ ini4j / Config.html#setEscape%28boolean%29
您可以尝试:
Config.getGlobal()。setEscape(false);
I'm reading in an absolute pathname from an ini file and storing the pathname as a String value in my program. However, when I do this, the value that gets stored somehow seems to be losing the backslash so that the path just comes out one big jumbled mess? For example, the ini file would have key, value of:
key=C:\folder\folder2\filename.extension
and the value that gets stored is coming out as C:folderfolder2filename.extension
.
Would anyone know how to escape the keys before it gets read in?
Let's also assume that changing the values of the ini file is not an alternative because it's not a file that I create.
Try setting the escape property to false in Ini4j.
You can try:
Config.getGlobal().setEscape(false);
这篇关于从ini文件读取路径,反斜杠转义字符消失?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!