简体   繁体   中英

How to escape double column in Java properties file?

I'm using

com.typesafe.config.ConfigFactory
// some time later 
params("myvar") = config.getString("myvar").trim  

the value of the key is a wasb address. It does seem that ":" does not work (as suggested by the error message), ie,

wasb":"//rest_of_the_path

What would be the escape character for : ?

You are not using the Properties API but TypeSafe Config .

You need to wrap that key into double-quotes. Quoting from TypeSafe Config documentation :

Unquoted strings are used literally, they do not support any kind of escaping. Quoted strings may always be used as an alternative when you need to write a character that is not permitted in an unquoted string.

As such, you key needs to be "wasb://rest_of_the_path"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM