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

Content deleted Content added
Chunes (talk | contribs)
Walterpachl (talk | contribs)
m REXX Version 2 - add REXX header
Line 532: Line 532:
: splitc ( str -- str' ) [ = ] monotonic-split ", " join ;
: splitc ( str -- str' ) [ = ] monotonic-split ", " join ;


"gHHH5YY++///\\"
"gHHH5YY++///\\" splitc print
"aaabbccccdeeff" [ splitc print ] bi@</lang>
"aaabbccccdeeff" splitc print</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 1,152: Line 1,152:


===version 2===
===version 2===
<lang rexx>/* REXX */
<lang rexx>Parse arg str /*obtain optional arguments from the CL*/
Parse arg str /*obtain optional arguments from the CL*/
if str=='' then str= 'gHHH5YY++///\' /*Not specified? Then use the default.*/
if str=='' then str= 'gHHH5YY++///\' /*Not specified? Then use the default.*/
input=str
input=str