This function searches for key a in properties file b and returns its value.
If a is not found, c will be returned.
If parameter d is set to true, keys in the property file may contain the wildcard *. See examples.
Parameters
Parameter | Description |
|---|---|
a | Key to be searched for in b. |
b | Name of the properties file. |
c | Default return value if key is not found. |
d | (optional) true for wildcard support. Default: false. |
Examples
Assume the following properties file:
# Country name to country code
Germany=DE
Austria=AT
New\ Zealand=NZNote: The backslash in "New\ Zealand" is a so-called escape character in properties file.
Parameter a | Parameter b | Parameter c | Parameter d | Result |
|---|---|---|---|---|
Germany | ./conf/replacements.properties | Somewhere | DE | |
Austria | ./conf/replacements.properties | Somewhere | AT | |
New Zealand | ./conf/replacements.properties | Somewhere | NZ | |
Dreamland | ./conf/replacements.properties | Somewhere | Somewhere |
Assume another properties file instead:
# Shortcuts for names
Invoice*=Invoice address
Number*=Number rangeParameter a | Parameter b | Parameter c | Parameter d | Result |
|---|---|---|---|---|
Invoices | ./conf/replacements.properties | Nothing | true | Invoice address |
Invoices | ./conf/replacements.properties | Nothing | false | Nothing |