StringSet (FPScript)
Replaces a substring starting from a predefined position in a string.
Syntax
StringSet(String, Substring, Position)
The syntax of the StringSet function consists of the following parts:
Part |
Description |
---|---|
String |
The string in which a substring is to be replaced. Permitted data structures are scalar value, data series und data matrix. Supported data types are string. |
Substring |
The substring that is to be written to the string. Permitted data structures are scalar value. Supported data types are string. |
Position |
The position at which the substring is to be replaced. Permitted data structures are scalar value, data series und data matrix. All integral data types are permitted. |
Remarks
The data type of the result is always string.
The structure of the result corresponds to that of the argument String.
If the specified position is after the end of the string, the string is appended at the end. If the specified position plus the length of the substring exceeds the length of the original string, the original string will be extended accordingly.
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 Position argument is a data series or data matrix, then the Position 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
StringSet("This is a test", "sample", 10) |
Returns the string "This is a sample". |
Dim names = {"M075_Val", "M633_Val", "M926_Val"} |
Results in the data series {"M075 Value", "M633 Value", "M926 Value"}. |
Dim names = {"M75_Val", "M633_Val", "M11850_Val"} |
Results in the data series {"M75 Value", "M633 Value", "M11850 Value"}. |