Search code examples
javascalaproperties-filetypesafe-config

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), i.e.,

wasb":"//rest_of_the_path

What would be the escape character for :?


Solution

  • 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"