VB6Parse / Library / String Manipulation / midb

VB6 Library Reference

MidB Statement

Replaces a specified number of bytes in a Variant (String) variable with bytes from another string.

Syntax

MidB(stringvar, start[, length]) = string

Remarks

Examples

Dim s As String
s = "ABCDEFGH"
MidB(s, 3, 2) = "12"       ' Replaces 2 bytes starting at byte 3

' For DBCS strings:
Dim dbcsStr As String
dbcsStr = "日本語"          ' Japanese characters
MidB(dbcsStr, 1, 2) = "XX" ' Replaces first 2 bytes

Reference

MidB Statement - Microsoft Docs

← Back to String Manipulation | View all statements