Replaces characters in the value contained in the source attribute based on replacement key-value pairs.
Specify the source attribute in which to perform character replacement.
Specifies whether the case of the characters in the source attribute needs to match the case of the characters specified in Replacement Pairs in order for a replacement to occur.
The replacement pairs parameter is a list of
key value key value ... .
Each instance of a key in the source string will be replaced with its corresponding value. If case-sensitive is no, then matching is done without regard to case differences. Both the keys and values may have multiple characters. Replacement is done in an ordered manner, so the key appearing first in the list will be checked first, and so on.
For example, if the source attribute’s value was:
bobby
and the replacement pairs were:
b s o a
the result will contain:
sassy
billy bob
and the replacement pairs were:
y\ b a
the result will contain:
billaob
If either of the strings contains a backslash \, it must be escaped with a backslash \. A single backslash not followed by a space will be ignored. For example, if the source attribute’s value was:
\billybob
And the replacement pairs were:
\\b a
The result will be:
aillybob
Specify a name for the attribute that holds the new string.
To substitute a substring specified using regular expressions, use the StringReplacer transformer.
Using a set of menu options, transformer parameters can be assigned by referencing other elements in the workspace. More advanced functions, such as an advanced editor and an arithmetic editor, are also available in some transformers. To access a menu of these options, click beside the applicable parameter. For more information, see Transformer Parameter Menu Options.
Associated FME function or factory: @Tcl2
Search for samples and information about this transformer on the FME Community.
Keywords: StringPairedReplacer