String interpolation (included): Difference between revisions
Content added Content deleted
(Added Quackery.) |
(Added Quackery.) |
||
Line 1,730:
'Mary had a little lamb.'
>>> </syntaxhighlight>
=={{header|Quackery}}==
'''The Task'''
Quackery does not have built-in string interpolation.
'''Not The Task'''
<code>interpolate$</code> replaces every instance of a specified character in a string with a specified string. Note that the specified string should not include the specified character as this will cause <code>interpolate$</code> to loop indefinitely.
<syntaxhighlight lang="Quackery"> [ temp put
swap
[ 2dup find
tuck over found while
over pluck drop
swap split
temp share
swap join join
again ]
nip nip temp release ] is interpolate$ ( $ n $ --> $ )
$ "Mary had a lamb." char X $ "little" interpolate$ echo$ cr
$ "Mary had a X lamb." char X $ "little" interpolate$ echo$ cr
$ "Mary had a X X lamb." char X $ "little" interpolate$ echo$ cr</syntaxhighlight>
{{out}}
<pre>Mary had a lamb.
Mary had a little lamb.
Mary had a little little lamb.
</pre>
=={{header|QB64}}==
<syntaxhighlight lang="qb64">
|