Description:
Returns a specified number of characters from a string.
In the PROMOTIC system it is better to use the Pm.StringSub method.
Syntax:
String Mid(String string, Integer start, [Integer length])
Parameters:
string | (String) Text string from which characters are returned. If string contains Null, then Null is returned. |
start | (Integer) Character position in the string at which the part to be taken begins. If it is greater than the number of characters in the string, then the function returns a empty string (""). The first character has the position 1. |
length | [optional] (Integer) The number of characters to return. If omitted or if there are fewer than length characters in the text (including the character at start position), then all characters from the start position to the end of the string are returned. |
---|
Note:
To determine the number of characters in the string, use the
Len function.
Example:
VBScriptSelect and copy to clipboard
Dim s
s = Mid("VB Script is fun!", 4, 6)
' s contains "Script"