8.3.7 Mid (return characters from inside a string)
- Purpose
-
Returns a substring containing a specified number of characters from inside a string.
- Syntax
Mid (String, Start [, Length])
- Arguments
-
- String
-
Specify the string itself or a variable that stores this value.
- Start
-
Specify the position from which to retrieve the characters as the offset from beginning of the string you set in String, where 1 is the first character.
A zero-length string ("") is returned if the Start value exceeds the number of characters in String.
- Length
-
Specify the number of characters to retrieve, or specify a variable that stores this value.
If you omit this value, or if the string contains fewer characters than this value, the Mid command returns all the characters from the start position.
- Description
-
The Mid command returns a substring containing a specified number of characters from inside a specified string.
One two-byte-character and one one-byte-character are both handled as one character.
To check the length of the string, use the Len command.
- Example
' This code stores "CDEFG" in variable string1. Dim string1 string1 = Mid ("ABCDEFGH", 3, 5)
- JP1/Script version
-
Supported from JP1/Script 01-00.