Split a character string based on change of character: Difference between revisions
Content deleted Content added
→{{header|Sed}}: flagged as having no output as per the task requirements. |
Added ZX Spectrum BASIC |
||
Line 983: | Line 983: | ||
g, HHH, 5, YY, ++, ///, \ |
g, HHH, 5, YY, ++, ///, \ |
||
</pre> |
</pre> |
||
=={{header|ZX Spectrum Basic}}== |
|||
<lang basic> 10 LET s$="gHHH5YY++///\" |
|||
20 LET c$=s$(1) |
|||
30 LET n$=c$ |
|||
40 FOR i=2 TO LEN s$ |
|||
50 IF s$(i)<>c$ THEN LET n$=n$+", " |
|||
60 LET n$=n$+s$(i) |
|||
70 LET c$=s$(i) |
|||
80 NEXT i |
|||
90 PRINT n$</lang> |
|||
{{out}} |
|||
<pre>g, HHH, 5, YY, ++, ///, \</pre> |