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

Content added Content deleted
(→‎K: add)
m (→‎{{header|ALGOL 68}}: Remove unnecessary "Works with" and unused variable)
Line 283: Line 283:


=={{header|ALGOL 68}}==
=={{header|ALGOL 68}}==
{{works with|ALGOL 68G|Any - tested with release 2.8.3.win32}}
<syntaxhighlight lang="algol68">BEGIN
<syntaxhighlight lang="algol68">BEGIN
# returns s with ", " added between each change of character #
# returns s with ", " added between each change of character #
Line 295: Line 294:
[ 3 * ( ( UPB s - LWB s ) + 1 ) ]CHAR result;
[ 3 * ( ( UPB s - LWB s ) + 1 ) ]CHAR result;
INT r pos := LWB result;
INT r pos := LWB result;
INT s pos := LWB s;
CHAR s char := s[ LWB s ];
CHAR s char := s[ LWB s ];
FOR s pos FROM LWB s TO UPB s DO
FOR s pos FROM LWB s TO UPB s DO