From akcs.kevin@hpcvbbs.UUCP Mon Oct 29 22:35:21 1990 From: akcs.kevin@hpcvbbs.UUCP (Kevin Jessup) Newsgroups: comp.sys.handhelds Subject: Search & Replace Keywords: hp48sx Date: 25 Oct 90 21:40:18 GMT 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***************