VBScript Mid
Function
The Mid function returns a specified number of characters from a string.
Tip: Use the Len function to determine the number of characters in a string.
Syntax
Parameter | Description |
---|---|
string | Required. The string expression from which characters are returned. |
start | Required. Specifies the starting position. If set to a value greater than the number of characters in the string, it returns an empty string (""). |
length | Optional. The number of characters to return. |
Example
Example 1
Returns 1 character, starting from position 1:
Output of the above example:
Example 2
Returns 15 characters, starting from position 1:
Output of the above example:
Example 3
Returns all characters, starting from position 1:
Output of the above example:
Example 4
Returns all characters, starting from position 12:
Output of the above example: