replace value by range(a, name of file b, default value c[, comparetype d])
Group |
Searches properties file b for the text a and replaces it by the value given in the file. The keys are interpreted as two values separated by a slash defining a from/to range. If a is within that range (including the boundaries), it will be replaced. If no replacement has taken place the default value c will be returned.
The type of comparison is controlled with parameter d. The following values can be specified.
Compare Type |
Meaning |
withcase |
The comparison will be case sensitive. a will be greater than A. |
nocase |
The comparison will be case insensitive. a will be equal to A. |
numeric |
The comparison will be numeric, i.e. only numbers will be compared. 10 will be greater than 2. |
Important note: The order the comparison will take place is coincidental, i.e. the ranges should not overlap. As well, in the case of compare type numeric, letters are interpreted as the value 0, so these can potentially fit for replacement as well.
Description of Parameters
Parameter |
Description |
a |
Value to be searched. |
b |
Name of the properties file. |
c |
Default value. |
d |
(optional) Type of comparison. Default: withcase. |
Examples
Note: Please note, in general, with regard to escape characters, the structure of a properties file.
The following properties files are defined.
aaaa/zzzz=lower alpha
AAAA/ZZZZ=upper alpha
0/9=below ten
AAAA/ZZZZ=alphas
0/9=below ten
0/9=below ten
Parameter a |
Parameter b |
Parameter c |
Parameter d |
Result |
aaaa |
withalpha.properties |
unknown |
lower alpha |
|
abcd |
withalpha.properties |
unknown |
lower alpha |
|
zzzz |
withalpha.properties |
unknown |
lower alpha |
|
ABCD |
withalpha.properties |
unknown |
upper alpha |
|
AbCd |
withalpha.properties |
unknown |
upper alpha |
|
10 |
withalpha.properties |
unknown |
below ten |
|
$ |
withalpha.properties |
unknown |
unknown |
|
abcd |
noalpha.properties |
unknown |
nocase |
alphas |
ABCD |
noalpha.properties |
unknown |
nocase |
alphas |
AbCd |
noalpha.properties |
unknown |
nocase |
alphas |
10 |
noalpha.properties |
unknown |
nocase |
below ten |
0 |
numbers.properties |
unknown |
numeric |
below ten |
9 |
numbers.properties |
unknown |
numeric |
below ten |
10 |
numbers.properties |
unknown |
numeric |
unknown |