StringLeft (FPScript)
Takes a substring out of a string starting from the left.
Syntax
StringLeft(String, Length)
The syntax of the StringLeft function consists of the following parts:
Part |
Description |
---|---|
String |
String from which a substring is to be taken. Permitted data structures are scalar value, data series und data matrix. Supported data types are string. |
Length |
The length of the substring. 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 length specified exceeds the length of the string, the complete string is passed. If the length is less than or equal to zero, an empty string is passed.
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 Length argument is a data series or data matrix, then the Length 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
StringLeft("This is an example", 4) |
Returns the substring "This". |
StringLeft({"2014-04-22", "2015-04-19", "2016-04-28"} , 4) |
Results in the data series {"2014", "2015", "2016"}. |
Dim names = {"M75_Val", "M633_Val", "M11850_Val"} |
Results in the data series {"M75", "M633", "M11850"}. |