Multisplit: Difference between revisions
Content added Content deleted
imported>Spikeysnack (Added C++23 version) |
(Added Easylang) |
||
Line 745: | Line 745: | ||
{{out}} |
{{out}} |
||
<pre>["a" "" "b" "" "c" ]</pre> |
<pre>["a" "" "b" "" "c" ]</pre> |
||
=={{header|EasyLang}}== |
|||
<syntaxhighlight> |
|||
proc multisplit str$ sep$[] . . |
|||
repeat |
|||
min = 1 / 0 |
|||
for sep$ in sep$[] |
|||
pos = strpos str$ sep$ |
|||
if pos > 0 and pos < min |
|||
min = pos |
|||
msep$ = sep$ |
|||
. |
|||
. |
|||
until min = 1 / 0 |
|||
write substr str$ 1 (min - 1) & "{" & msep$ & "}" |
|||
str$ = substr str$ (min + len msep$) 9999 |
|||
. |
|||
print str$ |
|||
. |
|||
multisplit "a!===b=!=c" [ "==" "!=" "=" ] |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
a{!=}{==}b{=}{!=}c |
|||
</pre> |
|||
=={{header|Elixir}}== |
=={{header|Elixir}}== |
||
{{trans|Erlang}} |
{{trans|Erlang}} |