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

Content deleted Content added
Walterpachl (talk | contribs)
m REXX Version 2 - add REXX header
Brought the three BASIC dialects under BASIC heading
Line 229:
</pre>
 
=={{header|BaConBASIC}}==
===BaCon===
Literal strings in BaCon are passed to the C compiler as they are; a backslash therefore needs to be escaped.
<lang freebasic>txt$ = "gHHH5YY++///\\"
Line 248 ⟶ 249:
</pre>
 
=={{header|=BBC BASIC}}===
<lang bbcbasic>REM >split
PRINT FN_split( "gHHH5YY++///\" )
Line 268 ⟶ 269:
{{out}}
<pre>g, HHH, 5, YY, ++, ///, \</pre>
 
===tbas===
{{Trans|BBC BASIC}}
<lang basic>SUB SPLITUNIQUE$(s$)
DIM c$, d$, split$, i%
c$ = LEFT$(s$, 1)
split$ = ""
FOR i% = 1 TO LEN(s$)
d$ = MID$(s$, i%, 1)
IF d$ <> c$ THEN
split$ = split$ + ", "
c$ = d$
END IF
split$ = split$ + d$
NEXT
RETURN split$
END SUB
 
PRINT SPLITUNIQUE$("gHHH5YY++///\")
END</lang>
 
=={{header|C}}==