Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -1,26 +1,26 @@
|
|||
/*REXX program to split a string based on different separator strings. */
|
||||
/*REXX program splits a string based on different separator strings.*/
|
||||
parse arg ? /*get string from command line. */
|
||||
if ?=='' then ? = 'a!===b=!=c' /*None specified? Use default.*/
|
||||
if ?=='' then ? = "a!===b=!=c" /*None specified? Use default.*/
|
||||
say 'old string='? /*echo the old string to screen. */
|
||||
zz = '0'x /*null char, can be most anything*/
|
||||
seps = '== != =' /*a list of seperaters to be used*/
|
||||
|
||||
seps = '== != =' /*a list of seperators to be used*/
|
||||
/* [↓] process tokens in SEPS.*/
|
||||
do j=1 for words(seps) /*parse string with all the seps.*/
|
||||
sep=word(seps,j) /*pick a separater to use now. */
|
||||
|
||||
sep=word(seps,j) /*pick a separator to use now. */
|
||||
/* [↓] process chars in the sep*/
|
||||
do k=1 for length(sep) /*parse for various sep versions.*/
|
||||
sep=strip(insert(zz,sep,k),,zz) /*allow imbedded "nulls" in sep. */
|
||||
?=changestr(sep,?,zz) /* ··· but not trailing "nulls". */
|
||||
|
||||
/* [↓] process strings in input*/
|
||||
do until ?==??; ??=? /*keep changing until no more chg*/
|
||||
?=changestr(zz || zz, ?, zz) /*reduce replicated "nulls". */
|
||||
end /*until···*/
|
||||
|
||||
/* [↓] use BIF or external prog.*/
|
||||
sep=changestr(zz, sep, '') /*remove true nulls from the sep.*/
|
||||
end /*k*/
|
||||
end /*j*/
|
||||
|
||||
showNull = ' {} ' /*one last change, allow the ... */
|
||||
?=changestr(zz,?,showNull) /*showing of "null" characters. */
|
||||
say 'new string='? /*now, show and tell time. */
|
||||
showNull = ' {} ' /*one more thing, display the ···*/
|
||||
?=changestr(zz,?,showNull) /* ··· showing of "null" chars. */
|
||||
say 'new string='? /*now, display the new string. */
|
||||
/*stick a fork in it, we're done.*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue