HP49-50G: transform "ABCDEF" into "ABDEF" (with no SUB?)
|
12-30-2020, 05:11 PM
Post: #1
|
|||
|
|||
HP49-50G: transform "ABCDEF" into "ABDEF" (with no SUB?)
I have a string "ABCDEF".
I look, say, for the letters "CD". If that strings "CD" exists, then I want to change it by "D" (with no "C"). The initial string "ABCDEF" should become "ABDEF" (without the letter C). My first idea was to write << "ABCDEF" DUP "CD" POS "" // Empty string (instead of "C") REPL // to be put instead of the original letter "C" >> But it does not work ("" REPL meaning "do not replace [the letter C]"). One "heavy" solution is then: \<< "ABCDEF" DUP SIZE \-> str siz \<< str "CD" POS \-> pos \<< str 1 pos 1 - SUB str pos 1 + siz SUB + \>> \>> \>> Question: How to write a shorter version, possibly with the instruction REPL (and not by concatenating ...Sub... ...SUB +)? Sorry for that simple question, but I would appreciate your insights. Regards, Gil |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
HP49-50G: transform "ABCDEF" into "ABDEF" (with no SUB?) - Gil - 12-30-2020 05:11 PM
RE: HP49-50G: transform "ABCDEF" into "ABDEF" (with no SUB?) - John Keith - 12-30-2020, 06:41 PM
RE: HP49-50G: transform "ABCDEF" into "ABDEF" (with no SUB?) - Gil - 12-30-2020, 06:49 PM
RE: HP49-50G: transform "ABCDEF" into "ABDEF" (with no SUB?) - ijabbott - 12-31-2020, 01:22 PM
RE: HP49-50G: transform "ABCDEF" into "ABDEF" (with no SUB?) - Gil - 12-31-2020, 07:37 PM
RE: HP49-50G: transform "ABCDEF" into "ABDEF" (with no SUB?) - Raymond Del Tondo - 01-01-2021, 10:28 AM
RE: HP49-50G: transform "ABCDEF" into "ABDEF" (with no SUB?) - Gil - 01-01-2021, 10:55 AM
|
User(s) browsing this thread: 1 Guest(s)