Small company logo:
   History
 
Advertising banner:
 
 Mid
Home • Help • Customization Tools • FCAS • Language Reference • Mid
 
Purpose
Returns a substring from within a string expression.
Syntax
Mid (StringExpression, StartOffset [, Length])


StringExpression
Any valid string.
StartOffset
The character offset from which to return the substring.
Length
The number of characters to return.
If Length is longer than the remaining number of characters in the string, all characters from the start and offset to the end of the string are returned.
If Length is omitted, Mid returns all characters from the start offset to the end of the string.

Example
Sub Main()
        Dim s As String
        Dim loc As Integer, loc2 As Integer
        s = "the quick fox runs fast"
        loc = InStr(1, s, " ")
        loc2 = InStr(loc + 1, s, " ")
                Print "token:"; Mid(s, loc + 1, loc2 - loc - 1);" ' "
End Sub