Article 2023 of comp.sys.handhelds: Path: en.ecn.purdue.edu!noose.ecn.purdue.edu!samsung!dali.cs.montana.edu!milton!uw-beaver!Teknowledge.COM!unix!hplabs!hp-pcd!hpcvra!rnews!hpcvbbs!akcs.kevin From: akcs.kevin@hpcvbbs.UUCP (Kevin Jessup) Newsgroups: comp.sys.handhelds Subject: Search & Replace Keywords: hp48sx Message-ID: <27275997-3d8comp.sys.handhelds@hpcvbbs.UUCP> Date: 25 Oct 90 21:40:18 GMT Lines: 61 Here is a program titled SRCHREPL (search and replace). The original was by Alan Weis. Inputs: Level 3: string Level 2: search string Level 1: replace string Outputs: Level 1: modified string from level 3 All occurances of the level 2 string were replaced by the level 1 string. At least thats how it was supposed to work. Actually, only the first character of the string in level 2 was replaced with the level 1 string. Example: Level 3: "123ABC456" Level 2: "ABC" Level 1: "TEST" Actual Result: Level 1: "123TESTBC456" Desired Result: Level 1: "123TEST456" The "BC" should have cut along with the "A". This version corrects the problem. To strip characters from the original, just place a null string, "", on level 1. Note that MULTI is required. It is listed here as well if you don't already have it. Apologies to ALAN or someone else if a corrected and/or faster version has already been posted! SRCHREPL \<< OVER SIZE \-> x y s \<< \<< DUP IF x POS DUP THEN DUP2 1 - 1 SWAP SUB 3 ROLLD s + OVER SIZE SUB y SWAP + + ELSE DROP END \>> MULTI \>> \>> MULTI \<< \-> p \<< DO DUP p EVAL UNTIL DUP ROT SAME END \>> \>> Kevin Jessup Marquette Electronics Milwaukee, WI (414)362-2020 **************END***************