Post Reply 
Emu48 Edit a CSV File
01-04-2022, 11:32 PM
Post: #11
RE: Emu48 Edit a CSV File
(01-04-2022 03:48 PM)DavidM Wrote:  \<<
OVER SIZE @ get length of target string
\-> targ new len @ assign locals
\<<
"" @ initial result: empty string
WHILE
OVER targ POS DUP @ loop while target found in remaining source
REPEAT
ROT DUP2 @ duplicate target pos/remaining source
1 ROT OVER - SUB @ extract chars preceding target
new + SWAP ROT @ append repl chars and reposition
len + 1E8 SUB @ extract remaining chars
ROT ROT + @ reposition/append to result
END
\>>
DROP @ drop leftover POS result (0)
SWAP + @ append remaining source to result
\>>[/code]

SL3: Source String
SL2: Target for match (text to be replaced)
SL1: Replacement text

It's my understanding that:

SL3 would be my CSV file
SL2 would be the ■ (linefeed) character
SL1 would be " " (whitespace)

\<<
OVER SIZE @ get length of target string
\-> targ new len @ assign locals
\<<


I don't understand your use of OVER. Wouldn't there be only one object on the stack? Also, you declare 3 local variables, but there would only be 2 objects on the stack.

Thanks again for your help!
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Emu48 Edit a CSV File - MNH - 12-30-2021, 07:24 AM
RE: Emu48 Edit a CSV File - MNH - 12-30-2021, 04:34 PM
RE: Emu48 Edit a CSV File - MNH - 12-30-2021, 10:30 PM
RE: Emu48 Edit a CSV File - DavidM - 12-31-2021, 10:54 AM
RE: Emu48 Edit a CSV File - MNH - 12-31-2021, 06:11 PM
RE: Emu48 Edit a CSV File - MNH - 01-01-2022, 04:41 AM
RE: Emu48 Edit a CSV File - DavidM - 01-04-2022, 03:48 PM
RE: Emu48 Edit a CSV File - MNH - 01-04-2022 11:32 PM
RE: Emu48 Edit a CSV File - DavidM - 01-05-2022, 12:14 PM
RE: Emu48 Edit a CSV File - DavidM - 01-08-2022, 11:22 AM
RE: Emu48 Edit a CSV File - MNH - 01-08-2022, 04:41 PM
RE: Emu48 Edit a CSV File - MNH - 01-08-2022, 07:41 PM
RE: Emu48 Edit a CSV File - DavidM - 01-09-2022, 02:34 PM
RE: Emu48 Edit a CSV File - DavidM - 01-10-2022, 10:50 AM
RE: Emu48 Edit a CSV File - MNH - 01-09-2022, 08:39 PM
RE: Emu48 Edit a CSV File - rprosperi - 01-10-2022, 04:01 AM
RE: Emu48 Edit a CSV File - DavidM - 01-10-2022, 12:41 PM
RE: Emu48 Edit a CSV File - DavidM - 01-14-2022, 04:25 PM
RE: Emu48 Edit a CSV File - MNH - 01-15-2022, 07:34 PM
RE: Emu48 Edit a CSV File - MNH - 01-04-2022, 11:06 PM
RE: Emu48 Edit a CSV File - John Keith - 12-31-2021, 06:51 PM
RE: Emu48 Edit a CSV File - MNH - 12-31-2021, 07:58 PM
RE: Emu48 Edit a CSV File - MNH - 01-04-2022, 11:39 PM
RE: Emu48 Edit a CSV File - Eric Rechlin - 01-05-2022, 03:22 PM
RE: Emu48 Edit a CSV File - MNH - 09-04-2022, 09:56 PM



User(s) browsing this thread: 2 Guest(s)