MID(stringvar, start [,length]) = string
Replaces a specified number of characters with characters from another string.
|stringvar||The text string (String).|
|start||The character position to start (Long).|
|length||(Optional) The number of characters to return (Long).|
|string||The string expression that replaces part of stringvar (String).|
|* The number of characters replaced is always less than or equal to the number of characters in stringvar.|
* Use the MidB statement with byte data contained in a string. In the MidB statement, start specifies the byte position within stringvar where replacement begins and length specifies the numbers of bytes to replace.
* This example uses the Mid statement to replace a specified number of characters in a string variable with characters from another string.
* You can use the MID - Function to replace a specified number of characters.
* For the Microsoft documentation refer to docs.microsoft.com
Dim sText As String
sText = "The dog jumps" ' Initialize string.
Mid(sText, 5, 3) = "fox" ' sText = "The fox jumps".
Mid(sText, 5) = "cow" ' sText = "The cow jumps".
Mid(sText, 5) = "cat runs fast" ' sText = "The cat runs".
Mid(sText, 5, 3) = "rabbit" ' sText = "The rab runs".
© 2020 Better Solutions Limited. All Rights Reserved. © 2020 Better Solutions Limited Top