The StringReplace function replaces a string in the input stream.
| Input | Data Type | Description |
|---|---|---|
| Input1 | String | The string to be modified. |
| Output | Data Type | Description |
|---|---|---|
| Output1 | String | The modified string. |
| Name | Property Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
| Mode | choice |
Specifies whether the substitution table used is read from a file or if the InlineTable is used.
|
||||||
| HomeDirectory | pathResolver | Specify the base folder of relative path of table file.
|
||||||
| FilePath | remoteFile | If Mode=File, this property specifies the file's path. The file under the user's home folder can be specified. | ||||||
| FileEncoding | choice | IfMode=File, this property specifies the table file's character encoding. | ||||||
| InlineTable | string | If Mode=Inline, this property specifies the inline substitution table's data. |
A substitution table may contain multiple rows, each row specifying the string to replace and the string to replace it in the form "string_to_replace=replacement_string".
abcde=ABCDE 01234=56789
The example substitution table above will replace the strings "abcde" with "ABCDE, and the strings "01234" with "56789".
The escape character \ can be used in the substitution table to create the following escape characters.
| \r | CR |
|---|---|
| \n | LF |
| \t | Tab |
| \= | = |
| \\ | \ |
| \uXXXX | the XXXX Unicode character |
When Mode is set to "File", contents of table is loaded at first execution in each request. This loaded contents is used in the same function in the same request until this request ends. In another words, the same loaded table is used even if the function is in the loop or it is used in subflow. When loading a table, it is checked whether the file is updated or not. If the file is not updated, it is not loaded in next request.
In Java, the character code is distinguished between in Windows-31J and in JIS system like Shift_JIS, EUC-JP, iso-2022-jp. Typically, the conversion between these character encoding is possible. But, because some characters have different code point of Unicode, the conversion will fail.
These are following 7 characters.
| Character | Code in Windows-31J(Or Shift_JIS) | Converted code by Windows-31J | Converted code by Shift_JIS |
|---|---|---|---|
| ― | 815C | 2015 | 2014 |
| ~ | 8160 | FF5E | 301C |
| ∥ | 8161 | 2225 | 2016 |
| - | 817C | FF0D | 2212 |
| ¢ | 8191 | FFE0 | 00A2 |
| £ | 8192 | FFE1 | 00A3 |
| ¬ | 81CA | FFE2 | 00AC |
If the conversion is failed in flow, using following table will avoid failure.
\u2015=\u2014 \uFF5E=\u301C \u2225=\u2016 \uFF0D=\u2212 \uFFE0=\u00A2 \uFFE1=\u00A3 \uFFE2=\u00AC- From JIS system code to Windows-31J
\u2014=\u2015 \u301C=\uFF5E \u2016=\u2225 \u2212=\uFF0D \u00A2=\uFFE0 \u00A3=\uFFE1 \u00AC=\uFFE2