Extracts and returns a substring of the string variable starting at a specific character position and with a specified length.
...string.Substring( first_pos, length )
Prerequisites
None
Parameters
first_pos
A required numeric expression. This specifies the position of the first character to be extracted and returned. Note, unlike the Mid function, the first character position is 0 rather than 1.
length
An optional numeric expression. This value specifies the number of characters to be copied into the returned value. If length is 0, the returned substring will be empty. If length is not specified, all of the remaining characters in the string starting at the first_pos will be copied.
Remarks
This method extracts a substring from the value of a String variable and returns the results. The substring is specified by its starting character position in the string and the number of characters to be extracted.
Examples
Dim stg_a, stg_result As String ' Create two string variables
stg_a = "aBcdef"
stg_result = stg_a.Substring(3, 2) ' stg_result will be set to "de"
See Also