StringReplace (FPScript)
Searches for a substring and replaces all occurrences with a different string.
Syntax
StringReplace(String, SearchString, ReplaceString)
The syntax of the StringReplace function consists of the following parts:
Part |
Description |
---|---|
String |
String to be searched. Permitted data structures are scalar value, data series und data matrix. Supported data types are string. |
SearchString |
Substring for which to search; its occurrences are to be replaced. Permitted data structures are scalar value. Supported data types are string. |
ReplaceString |
String to be replaced by the strings found. Permitted data structures are scalar value, data series und data matrix. Supported data types are string. |
Remarks
The data type of the result is always string.
The structure of the result corresponds to that of the argument String.
The result is a string in which the replacements are made.
If the String argument is a data series or data matrix, the calculation is performed on a per-element basis and the result is either a data series or a data matrix. If the ReplaceString argument is a data series or data matrix, then the ReplaceString must match the String argument in the number of rows and, if applicable, number of columns.
If an argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.
Available in
FlexPro Basic, Professional, Developer Suite
Examples
StringReplace("This is an example", "Example", "Test") |
Results in "This is a test". |
StringReplace("C:\\Program Files\\Weisang\\FlexPro", "\\", "\\\\") |
Results in "C:\\Program Files\\Weisang\\FlexPro". Doubles all '\' characters in a path. Note that the '\' character in an FPScript string constant must always be written twice. |
StringReplace({"15-01-2017", "12-02-2017", "22-03-2017"}, "-", ".") |
Results in the data series {"15.01.2017", "12.02.2017", "22.03.2017"} |
Dim id = {"FX53", "WQ918", "PPS44"} |
Results in the data series {"FX53 (Voltage)", "WQ918 (Current)", "PPS44 (Temperature)"} |