(12-31-2021 10:54 AM)DavidM Wrote: (12-30-2021 07:24 AM)MNH Wrote: ... Any help with this program would be greatly appreciated!
One approach I've used in the past to do similar things involves building a syntactically-correct string for the final object, then simply converting that string to an object with STR→. SREPL is very handy for converting the linefeeds (it's also very fast).
Here's one way to do that with the sample data you provided. It leaves the result in stack level 1 upon completion:
Code:
\<<
FILE @ recall source string to stack
"{\"" SWAP + @ place {" chars at beginning
"\"}" + @ place "} chars at end
10 CHR @ place linefeed char on stack
"\" \"" @ place " " chars on stack
SREPL DROP @ replace all linefeeds with " "
STR\-> @ convert the resulting string to an RPL object
\>>
This is simply an alternative method for accomplishing the same goal. Hope this gives you some ideas!
(edit: corrected a transcription error in the source code)
I tried using REPL to replace characters in a string with white space. No luck.