CHANGESTR.REX: Difference between revisions

m
correct spelling(s)
(added a sample REXX code for the CHANGESTR subroutine. -- ~~~~)
 
m (correct spelling(s))
Line 4:
║ original string (haystack)────────┐ │ │ [default: ≈ one billian]║
║ old string to be changed───┐ │ │ │ ┌───begin at this occurance #.║
║ {O, H, and N can be null.} │ │ │ │ │ [default: 1st occurranceoccurrence]║
╚═╦════════════════════════════╗ │ │ │ │ │ ╔═══════════════════════╦═╝
╚════════════════════════════╝ ↓ ↓ ↓ ↓ ↓ ╚═══════════════════════╝*/
Line 13:
w=length(o) /*length of OLD string.*/
if w==0 & t\=0 then return n || h /*changing a null char ? */
#=0 /*# of changed occurancesoccurrences*/
do j=1 until # >= t /*keep changing, T times.*/
parse var h y (o) _ +(w) h /*parse the string ... */
Line 20:
else do
$=$ || y || n /*build new STR from S. */
#=#+1 /*bump occuranceoccurrence number. */
end
end /*j*/
2,289

edits