getPropertyString

Returns the value of one key in a Java properties file. Returns an empty string if the key is not defined.

getPropertyString(filepath, key [, encoding]) → returns string

Argument Reference

filepath string
Required

Absolute path to the properties file.

key string
Required

The key to look up.

encoding string
Default: utf-8

Character encoding of the file.

Examples
Sample code invoking the getPropertyString function

path = getTempDirectory() & "app.properties";
fileWrite(path, "a=1#chr(10)#b=hello");
writeOutput(getPropertyString(path, "b"));

Expected Result: hello

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub