Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!pikes!boulder!ccncsu!longs.LANCE.ColoState.Edu!robert From: robert@longs.LANCE.ColoState.Edu (Robert Thompson) Newsgroups: comp.sys.handhelds Subject: A global search and replace program (HP-28) Message-ID: <5394@ccncsu.ColoState.EDU> Date: 20 Mar 90 05:00:35 GMT Sender: news@ccncsu.ColoState.EDU Reply-To: robert@longs.LANCE.ColoState.Edu (Robert Thompson) Organization: Colorado State University, Fort Collins, CO 80523 Lines: 42 Here is a program I wrote so that I could put special characters in code/strings/ etc. I later rewrote the program using all the sysevals I could to make it faster. It is now about 3 times faster than before. This shows the use of the sysevals to those who are just getting into it. The sysevals were taken from the list posted here several weeks ago (the infamous syseval list). Hope someone else can use this too. Robert Thompson Center for Computer Assisted Engineering Colorado State University usage: 3. replacement character 2. character to replace 1. program/string/whatever to change result: string on level 1 with characters changed This is probably meaningless but here are some stats: string length time in seconds ------------- --------------- 548 (LCD->) 91.7 You will probably NEVER do this :) [Replace every chr(0) with the letter "V"] 62 0.9 [Replace 4 E's with sigmas] 10 (10 Z's) 1.6 [Replace all the Z's with U's] SED [3804] << ->STR 'p' #A252h SYSEVAL -> I R ; STO_globalname << WHILE p R #2283Ah SYSEVAL DUP 0 <> ; POS_string REPEAT p 1 #3D7F8h SYSEVAL 1 - ; PICK3_1any2any3any #785Ah SYSEVAL I p ; SUB_1real2real3string #3D6C5h SYSEVAL 1 + p ; ROLL4_1any2any3any4any #792Ah SYSEVAL ; SIZE_string #785Ah SYSEVAL + + 'p' #A252h SYSEVAL END >> DROP 'p' #BFFD SYSEVAL SWAP PURGE ; DUP&RCL_name >>