PropertiesConfiguration - 使用" /"在物业价值 [英] PropertiesConfiguration - Using "/" in Property value

查看:144
本文介绍了PropertiesConfiguration - 使用" /"在物业价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PropertiesConfiguration来加载和存储属性值。

I am using PropertiesConfiguration for loading and storing property values.

如果我在Property值中使用字符'/',则会将其保存为'\ /'。你能帮助我保存'/'而不是'\ /'吗?我在这里遗漏了什么吗?

If I use character '/' in Property value, it gets saved as'\/'. Could you please help me in saving just '/' instead of '\/'? Am I missing something here?

PropertiesConfiguration databaseProperties;
databaseProperties = new PropertiesConfiguration("Properties.properties");
databaseProperties.setProperty("PropName", "jdbc:sqlserver://");
databaseProperties.save();

保存我的属性文件后,其值为

After saving my property file has value as

PropName = jdbc:sqlserver:\/\/

谢谢,

推荐答案

完成 / 的转义以满足属性文件格式的要求。此格式在 的JavaDoc> Properties.load(读者)

The escaping of / is done to fulfill the requirements of the properties file format. This format is described at the JavaDoc of Properties.load(Reader).

如果那是没有你想要什么,那么你真的不想要一个属性文件,而是一些其他(可能类似的)格式。

If that's not what you want, then you don't really want a properties file, but some other (possibly similar) format.

这篇关于PropertiesConfiguration - 使用" /"在物业价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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