The Mid
assignment statement assigns a string into another string. The left hand side of the assignment has the same syntax as a call to the function Microsoft.VisualBasic.Strings.Mid
– the first parameter is the string (whose type must be implicitly convertible to and from String
), the second is the one-based start position (whose type must be implicitly convertible to Integer
) and the optional third parameter is the length (whose type must be implicitly convertible to Integer
). The right hand side is a string whose type must be implicitly convertible to String
. The right hand side is truncated to the length parameter (if any) and replaces the characters in the left hand side string, starting at the start position.
At runtime, the right hand side of the assignment is evaluated first, then the arguments to Mid
are evaluated from left to right. If the variable is a property, it must have a property getter and a property setter, otherwise an error occurs. Note that Mid
is not a reserved word.
Mid
[ $
] (
VariableExpression ,
Expression [ ,
Expression ] )
=
Expression StatementTerminator