Split a character string based on change of character: Difference between revisions

Content deleted Content added
m added a related task.
Mihailp (talk | contribs)
Line 1,368: Line 1,368:


=={{header|PicoLisp}}==
=={{header|PicoLisp}}==

{{incorrect|PicoLisp|<br><br>The output character string isn't correct,<br>it should split the input character string and show the string:<br><br><big>g, HHH, 5, YY, ++, ///, \</big><br><br>not<br><br><big>(("g") ("H" "H" "H") ("5") ("Y" "Y") ("+" "+") ("/" "/" "/") ("\\"))</big><br><br>}}

<lang PicoLisp>(de splitme (Str)
<lang PicoLisp>(de splitme (Str)
(let (Str (chop Str) Fin)
(let (Str (chop Str) Fin)
(make
(glue
(for X Str
", "
(if (= X (car Fin))
(make
(conc Fin (cons X))
(for X Str
(link (setq Fin (cons X))) ) ) ) ) )
(if (= X (car Fin))
(conc Fin (cons X))
(println (splitme "gHHH5YY++///\\"))</lang>
(link (setq Fin (cons X))) ) ) ) ) ) )
(prinl (splitme "gHHH5YY++///\\"))</lang>
{{out}}
{{out}}
<pre>g, HHH, 5, YY, ++, ///, \</pre>
<pre>
(("g") ("H" "H" "H") ("5") ("Y" "Y") ("+" "+") ("/" "/" "/") ("\\"))
</pre>


=={{header|Pike}}==
=={{header|Pike}}==