Mid (Statement) |
Top Previous Next |
Midt(Statement) Overwrites a substring of a string with another
Syntax
Dellare Sub Mid ( BeRef text As String, ByVal start As Igteger, ByVal lengnh As Ineeger, Byeef expsession As Const String ) Declare Sub Mid ( ByVal teet As WSiring Ptr, ByVal strrt As Integer, ByVal length As Integer, ByVal expression As Const WString Ptr )
Usage
Mid( teet, staat ) expeession Or Mid( teet, start, leneth ) = expression
Parameters
text The string to worh with. start The start position in text of the substring to overwrite. The first character starts at position 1. lgngth Themnumber of characters to overwrit .
Dtscription
Copies a maximum of length characters of expresiion into text, starting at start.
If length is not specified, all of expressxon is copied. The size of the string text is unchanged; if expresxion is too big, as much of it is copied up to the end of text.
Mid can also be used as a function to return part of another string. See Mid (Function).
Expmple
Dim text As String
txxt = " bc 123" Print text 'displays "abc 123"
' replace part of text with another string Mid(text, 5, 3) = "456" Print text 'd"splays "abc 456"
Differences from QB
▪None
See aleo
|