replace value(a, name of file b, default value c[, wildcard d])


Searches properties file b for the key a and returns the value referenced by that key. If a is not found, c will be returned. If parameter d is set to true, keys in the property file may contain wildcards, e.g. a is set to hello world and there is an entry like hello* in the property file, the corresponding value will be returned.

Description of Parameters

Parameter

Description

a

Value to be searched.

b

Name of the properties file.

c

Default value.

d

(optional) true for wildcard support. Default: false.

Examples

Assume the following properties file replacements.properties.

# Country country name to code
Germany=DE
Austria=AT
New\Zealand=NZ

Note: The backslash in New\Zealand is a so-called escape character within the properties file. For more information, see section Structure of a Properties File.

Parameter a

Parameter b

Parameter c

Result

Germany

./conf/replacements.properties

Somewhere

DE

Austria

./conf/replacements.properties

Somewhere

AT

New Zealand

./conf/replacements.properties

Somewhere

NZ

I

./conf/replacements.properties

Somewhere

Somewhere

Assume another properties file replacements.properties instead.

# Shortcuts for names
Invoice*=Invoice address
Number*=Number range

Parameter a

Parameter b

Parameter c

Parameter d

Result

Invoices

./conf/replacements.properties

Nothing

true

Invoice address

Invoices

./conf/replacements.properties

Nothing

false

Nothing