Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions _build/pages/guide.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -1917,6 +1917,7 @@ with this library and SmallBASIC must be linked against it.
(`\`)
- `ANTIALIAS on,off` : Enable/Disable anti-aliasing for drawing commands like
`CIRCLE` or `LINE`
- `OPTION PREDEF AUTOLOCAL`: All variables are local by default

`OPTION PREDEF` is a compile-time option.

Expand Down
1 change: 1 addition & 0 deletions _build/reference/1442-system-option.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ Used to pass parameters to the run-time environment.
| OPTION PREDEF GRMODE [WIDTHxHEIGHT[xBPP]] | Sets the graphics mode flag (-g option) or sets the preferred screen resolution. Example: `OPTION PREDEF GRMODE 320x320x16`
| OPTION PREDEF TEXTMODE | Sets the text mode flag (-g- option)
| OPTION PREDEF CSTR | Sets as default string style the C-style special character encoding (`\`)
| OPTION PREDEF AUTOLOCAL | All variables are local by default
4 changes: 2 additions & 2 deletions _build/reference/790-string-replace.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

> s = REPLACE (source, pos, str [, len])

Writes the string `str` into string `source` at position `pos` and returns the new string. This function replaces `len` characters. The default value of `len` is the length of `str`.
Writes the string `str` into string `source` at position `pos` and returns the new string. This function replaces `len` characters. The default value of `len` is the length of `str`. Instead of a string, a number can be passed as a parameter. The number will be interpreted as a string.

### Example 1:

Expand All @@ -11,6 +11,7 @@ print replace("abcdef", 3, "1") ' Output: ab1def
print replace("abcdef", 3, "12") ' Output: ab12ef
print replace("abcdef", 3, "123") ' Output: ab123f
print replace("abcdef", 3, "1234") ' Output: ab1234
print replace("abcdef", 3, 1234) ' Output: ab1234 <- number 1234 is interpreted as string "1234"
print replace("abcdef", 3, "1234", 0) ' Output: ab1234cdef <- inserted, no replacement
print replace("abcdef", 3, "1234", 1) ' Output: ab1234def <- only c was replaced
print replace("abcdef", 3, "1234", 2) ' Output: ab1234ef <- only cd was replaced
Expand Down Expand Up @@ -68,4 +69,3 @@ cls
? lset("Create TEXT"); colors(Replace("", 1, TEXT))
```


4 changes: 3 additions & 1 deletion pages/guide.html
Original file line number Diff line number Diff line change
Expand Up @@ -1935,6 +1935,8 @@ <h3 id="Statement4">OPTION PREDEF</h3>
character encoding (<code>\</code>)</li>
<li><code>ANTIALIAS on,off</code> : Enable/Disable anti-aliasing for
drawing commands like <code>CIRCLE</code> or <code>LINE</code></li>
<li><code>OPTION PREDEF AUTOLOCAL</code>: All variables are local by
default</li>
</ul>
<p><code>OPTION PREDEF</code> is a compile-time option.</p>
<h2 id="Meta">Meta Commands</h2>
Expand Down Expand Up @@ -1997,7 +1999,7 @@ <h2 id="ExceptionHandling">Exception Handling</h2>
href="https://smallbasic.github.io/reference/1425.html">TRY</a>.</p>
</div>
<div class="pagefooter">
This page was last edited on Tue, 2 Sep 2025 21:28:15 +0200
This page was last edited on Mon, 10 Nov 2025 22:46:08 +0100
|
<a href="https://en.wikipedia.org/wiki/Markdown" target="_blank" rel="nofollow">Markdown</a>
processed with
Expand Down
24 changes: 14 additions & 10 deletions reference/1442.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,53 +53,57 @@ <h1>OPTION</h1>
<col style="width: 50%" />
</colgroup>
<thead>
<tr class="header">
<tr>
<th style="text-align: left;">Option</th>
<th style="text-align: left;">Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<tr>
<td style="text-align: left;">OPTION BASE 0,1</td>
<td style="text-align: left;">Set lowest allowed index of arrays to 0 or
1</td>
</tr>
<tr class="even">
<tr>
<td style="text-align: left;">OPTION PREDEF ANTIALIAS on,off</td>
<td style="text-align: left;">Set anti-aliasing for drawing lines or
circles</td>
</tr>
<tr class="odd">
<tr>
<td style="text-align: left;">OPTION MATCH PCRE [CASELESS]SIMPLE</td>
<td style="text-align: left;">Set matching algorithm to
(P)erl-(C)ompatible (R)egular (E)xpressions library or back to simple
one for LIKE and FILES</td>
</tr>
<tr class="even">
<tr>
<td style="text-align: left;">OPTION PREDEF QUIET</td>
<td style="text-align: left;">Sets the quiet flag (-q option)</td>
</tr>
<tr class="odd">
<tr>
<td style="text-align: left;">OPTION PREDEF COMMAND cmdstr</td>
<td style="text-align: left;">Sets the COMMAND$ string to cmdstr (useful
for debug reasons)</td>
</tr>
<tr class="even">
<tr>
<td style="text-align: left;">OPTION PREDEF GRMODE
[WIDTHxHEIGHT[xBPP]]</td>
<td style="text-align: left;">Sets the graphics mode flag (-g option) or
sets the preferred screen resolution. Example:
<code>OPTION PREDEF GRMODE 320x320x16</code></td>
</tr>
<tr class="odd">
<tr>
<td style="text-align: left;">OPTION PREDEF TEXTMODE</td>
<td style="text-align: left;">Sets the text mode flag (-g- option)</td>
</tr>
<tr class="even">
<tr>
<td style="text-align: left;">OPTION PREDEF CSTR</td>
<td style="text-align: left;">Sets as default string style the C-style
special character encoding (<code>\</code>)</td>
</tr>
<tr>
<td style="text-align: left;">OPTION PREDEF AUTOLOCAL</td>
<td style="text-align: left;">All variables are local by default</td>
</tr>
</tbody>
</table>
<div class="lavenderBox">
Expand Down Expand Up @@ -173,7 +177,7 @@ <h1>OPTION</h1>
|
<a href="https://en.wikipedia.org/wiki/Markdown" target="_blank" rel="nofollow">Markdown</a>
processed with
<a href="https://pandoc.org/MANUAL.html#pandocs-markdown" target="_blank" rel="nofollow">pandoc 3.1.12.1</a>
<a href="https://pandoc.org/MANUAL.html#pandocs-markdown" target="_blank" rel="nofollow">pandoc 3.2.1</a>
</div>
</div>
</div>
Expand Down
17 changes: 11 additions & 6 deletions reference/790.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,20 @@ <h1>REPLACE</h1>
<p>Writes the string <code>str</code> into string <code>source</code> at
position <code>pos</code> and returns the new string. This function
replaces <code>len</code> characters. The default value of
<code>len</code> is the length of <code>str</code>.</p>
<code>len</code> is the length of <code>str</code>. Instead of a string,
a number can be passed as a parameter. The number will be interpreted as
a string.</p>
<h3 id="example-1">Example 1:</h3>
<div class="sourceCode" id="cb1"><pre
class="sourceCode smallbasic"><code class="sourceCode smallbasic"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="kw">print</span> <span class="fu">replace</span>(<span class="st">&quot;abcdef&quot;</span>, <span class="dv">3</span>, <span class="st">&quot;1&quot;</span>) <span class="co">&#39; Output: ab1def</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="kw">print</span> <span class="fu">replace</span>(<span class="st">&quot;abcdef&quot;</span>, <span class="dv">3</span>, <span class="st">&quot;12&quot;</span>) <span class="co">&#39; Output: ab12ef</span></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="kw">print</span> <span class="fu">replace</span>(<span class="st">&quot;abcdef&quot;</span>, <span class="dv">3</span>, <span class="st">&quot;123&quot;</span>) <span class="co">&#39; Output: ab123f</span></span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="kw">print</span> <span class="fu">replace</span>(<span class="st">&quot;abcdef&quot;</span>, <span class="dv">3</span>, <span class="st">&quot;1234&quot;</span>) <span class="co">&#39; Output: ab1234</span></span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a><span class="kw">print</span> <span class="fu">replace</span>(<span class="st">&quot;abcdef&quot;</span>, <span class="dv">3</span>, <span class="st">&quot;1234&quot;</span>, <span class="dv">0</span>) <span class="co">&#39; Output: ab1234cdef &lt;- inserted, no replacement</span></span>
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a><span class="kw">print</span> <span class="fu">replace</span>(<span class="st">&quot;abcdef&quot;</span>, <span class="dv">3</span>, <span class="st">&quot;1234&quot;</span>, <span class="dv">1</span>) <span class="co">&#39; Output: ab1234def &lt;- only c was replaced</span></span>
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a><span class="kw">print</span> <span class="fu">replace</span>(<span class="st">&quot;abcdef&quot;</span>, <span class="dv">3</span>, <span class="st">&quot;1234&quot;</span>, <span class="dv">2</span>) <span class="co">&#39; Output: ab1234ef &lt;- only cd was replaced</span></span>
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a><span class="kw">print</span> <span class="fu">replace</span>(<span class="st">&quot;abcdef&quot;</span>, <span class="dv">3</span>, <span class="st">&quot;&quot;</span>, <span class="fu">len</span>(<span class="st">&quot;abcdef&quot;</span>)) <span class="co">&#39; Output: ab &lt;- cut</span></span></code></pre></div>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a><span class="kw">print</span> <span class="fu">replace</span>(<span class="st">&quot;abcdef&quot;</span>, <span class="dv">3</span>, <span class="dv">1234</span>) <span class="co">&#39; Output: ab1234 &lt;- number 1234 is interpreted as string &quot;1234&quot;</span></span>
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a><span class="kw">print</span> <span class="fu">replace</span>(<span class="st">&quot;abcdef&quot;</span>, <span class="dv">3</span>, <span class="st">&quot;1234&quot;</span>, <span class="dv">0</span>) <span class="co">&#39; Output: ab1234cdef &lt;- inserted, no replacement</span></span>
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a><span class="kw">print</span> <span class="fu">replace</span>(<span class="st">&quot;abcdef&quot;</span>, <span class="dv">3</span>, <span class="st">&quot;1234&quot;</span>, <span class="dv">1</span>) <span class="co">&#39; Output: ab1234def &lt;- only c was replaced</span></span>
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a><span class="kw">print</span> <span class="fu">replace</span>(<span class="st">&quot;abcdef&quot;</span>, <span class="dv">3</span>, <span class="st">&quot;1234&quot;</span>, <span class="dv">2</span>) <span class="co">&#39; Output: ab1234ef &lt;- only cd was replaced</span></span>
<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a><span class="kw">print</span> <span class="fu">replace</span>(<span class="st">&quot;abcdef&quot;</span>, <span class="dv">3</span>, <span class="st">&quot;&quot;</span>, <span class="fu">len</span>(<span class="st">&quot;abcdef&quot;</span>)) <span class="co">&#39; Output: ab &lt;- cut</span></span></code></pre></div>
<h3 id="example-2">Example 2:</h3>
<div class="sourceCode" id="cb2"><pre
class="sourceCode smallbasic"><code class="sourceCode smallbasic"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="dt">Const</span> TEXT = <span class="st">&quot;Red Green Blue&quot;</span> <span class="co">&#39; Text to replace:</span></span>
Expand Down Expand Up @@ -113,7 +116,9 @@ <h3 id="example-2">Example 2:</h3>
<div class="linklist">
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/graphics 2/3d rotating cube with message.bas">3d rotating cube with message.bas </a>&nbsp;
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/games 1/anball 1.0.bas">anball 1.0.bas </a>&nbsp;
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/games 1/checkers.bas">checkers.bas </a>&nbsp;
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/games 3/checkers.bas">checkers.bas </a>&nbsp;
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/games 1/chess.bas">chess.bas </a>&nbsp;
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/games 3/chess.bas">chess.bas </a>&nbsp;
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/graphics 1/conrec-sb-v01.bas">conrec-sb-v01.bas </a>&nbsp;
<a target="_github" href="https://raw.githubusercontent.com/smallbasic/smallbasic.samples/master/games 2/hangman v2.bas">hangman v2.bas </a>&nbsp;
Expand Down Expand Up @@ -184,7 +189,7 @@ <h3 id="example-2">Example 2:</h3>
|
<a href="https://en.wikipedia.org/wiki/Markdown" target="_blank" rel="nofollow">Markdown</a>
processed with
<a href="https://pandoc.org/MANUAL.html#pandocs-markdown" target="_blank" rel="nofollow">pandoc 3.1.12.1</a>
<a href="https://pandoc.org/MANUAL.html#pandocs-markdown" target="_blank" rel="nofollow">pandoc 3.2.1</a>
</div>
</div>
</div>
Expand Down