vb6parse 1.0.0

vb6parse is a library for parsing and analyzing VB6 code, from projects, to controls, to modules, and forms.
Documentation
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="VB6Parse Library Reference - midb - String Manipulation">
    <title>midb - String Manipulation - VB6Parse Library Reference</title>
    <link rel="stylesheet" href="../../../assets/css/style.css">
    <link rel="stylesheet" href="../../../assets/css/docs-style.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css">
    <script src="../../../assets/js/theme-switcher.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/vbnet.min.js"></script>
    <script>hljs.highlightAll();</script>
</head>
<body>
    <header class="docs-header">
        <div class="container">
            <h1><a href="../../../index.html">VB6Parse</a> / <a href="../../../library/index.html">Library</a> / <a href="../../../library/statements/string_manipulation/index.html">String Manipulation</a> / midb</h1>
            <p class="tagline">VB6 Library Reference</p>
        </div>
    </header>

    <nav class="docs-nav">
        <div class="container">
            <a href="../../../index.html">Home</a>
            <a href="../../../library/index.html">Library Reference</a>
            <a href="../../../documentation.html">Documentation</a>
            <a href="https://docs.rs/vb6parse" target="_blank">API Docs</a>
            <a href="https://github.com/scriptandcompile/vb6parse" target="_blank">GitHub</a>
            <button id="theme-toggle" class="theme-toggle" aria-label="Toggle theme">
                <span class="theme-icon">🌙</span>
            </button>
        </div>
    </nav>

    <main class="container">
        
        <article class="library-item">
            <h1 id="midb-statement">MidB Statement</h1>
<p>Replaces a specified number of bytes in a Variant (String) variable with bytes from another string.</p>
<h2 id="syntax">Syntax</h2>
<pre><code class="language-vbnet">MidB(stringvar, start[, length]) = string</code></pre>
<ul>
<li><code>stringvar</code>: Required. Name of string variable to modify</li>
<li><code>start</code>: Required. Byte position where replacement begins (1-based)</li>
<li><code>length</code>: Optional. Number of bytes to replace. If omitted, uses entire length of <code>string</code></li>
<li><code>string</code>: Required. String expression used as replacement</li>
</ul>
<h2 id="remarks">Remarks</h2>
<ul>
<li><code>MidB</code> is used with byte data contained in a string</li>
<li>Works with byte positions rather than character positions (important for double-byte character sets)</li>
<li>The number of bytes replaced is always less than or equal to the number of bytes in <code>stringvar</code></li>
<li>If <code>start</code> is greater than the number of bytes in <code>stringvar</code>, <code>stringvar</code> is unchanged</li>
<li>If <code>length</code> is omitted, all bytes from <code>start</code> to the end of the string are replaced</li>
<li><code>MidB</code> statement replaces bytes in-place; it does not change the byte length of the original string</li>
<li>If replacement string is longer than <code>length</code>, only <code>length</code> bytes are used</li>
<li>If replacement string is shorter than <code>length</code>, only available bytes are replaced</li>
<li>Primarily used when working with double-byte character sets (DBCS) like Japanese, Chinese, or Korean</li>
</ul>
<h2 id="examples">Examples</h2>
<pre><code class="language-vbnet">Dim s As String
s = &quot;ABCDEFGH&quot;
MidB(s, 3, 2) = &quot;12&quot;       &#x27; Replaces 2 bytes starting at byte 3
&#x27; For DBCS strings:
Dim dbcsStr As String
dbcsStr = &quot;日本語&quot;          &#x27; Japanese characters
MidB(dbcsStr, 1, 2) = &quot;XX&quot; &#x27; Replaces first 2 bytes</code></pre>
<h2 id="reference">Reference</h2>
<p><a href="https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/midb-statement">MidB Statement - Microsoft Docs</a></p>
        </article>
        
        <div style="margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border-color);">
            <p>
                <a href="index.html">← Back to String Manipulation</a> |
                <a href="../index.html">View all statements</a>
            </p>
        </div>

    </main>

    <footer>
        <div class="container">
            <p>&copy; 2024-2026 VB6Parse Contributors. Licensed under the MIT License.</p>
        </div>
    </footer>
</body>
</html>