@SubString
@SUBSTRING
returns the substring that begins with the character at the beginning index and extends to the character before the ending index. The beginning index starts with zero, and the text that is returned does not include the ending index. If the ending index is greater than the number of characters in the string, then nothing is returned.
DTP Type:
@SUBSTRING
can be assigned to a DTP of type member, members, dimension, dimensions, string, or password.
Syntax:
@SUBSTRING(String,Beginning Index,Ending Index)
Parameters:
Parameter | Description |
---|---|
String |
Design-time prompt or text |
Beginning Index |
Design-time prompt numeric or text |
Ending Index |
Design-time prompt of the numeric or text |
Example:
[SUBSTRING_Str]=@SUBSTRING([String1],[start_ind],[end_ind])
Where:
-
[SUBSTRING_Str]
is a DTP of type string that is not a checked prompt. -
[String1]
is a DTP of type string that is a checked prompt. -
[start_ind]
is a DTP of type numeric that is a checked prompt. -
[end_ind]
is a DTP of type numeric that is a checked prompt.
Assume that the parameters are as follows:
-
String: "This is a test of converting characters to strings."
-
Beginning Index: "2"
-
Ending Index: "16"
In this example, [SUBSTRING_Str]
returns "his is a test o" because the
second character in the string is the "h" in "this" and the 15th character
is the "o" at the beginning of the word "of".