XSEARCH
=======
Search for a given string in memory
This command is largely Simon Goodwin's code (thanks Simon!) with a few
tweaks of my own. I use a character table for translations which ought to be
a wee bit faster (but doesnt amount to much, strangely). It is also
considerably bulkier, but the justification for this is that one could
have different tables, for example a table that treated accented
characters as equal to their unaccented brethren or that used different
character sets altogether, all without having to change the code.
However, I havent made the tables easily exchangable; the code has to be
reassembled with a different table to do that.
Usage
=====
found_at = XSEARCH ( address, length , | ! string$ )
where
, => case agnostic and
! => case conscious (this can be twice as fast!)
Example
=======
100 text$ = 'software status'
110 fnm$ = HOME_DIR$ & 'XSEARCH_txt'
120 ch = FOP_IN(fnm$): ERT ch
130 fl = FLEN(#ch): CLOSE#ch
140 ad = ALCHP(fl)
150 LBYTES fnm$, ad
160 fnd = XSEARCH(ad, fl, text$)
170 IF fnd THEN
180 PRINT text$! 'found at'! fnd - ad
190 ELSE
200 PRINT text$! 'not found'
210 END IF
220 RECHP ad
Now alter the separator in line 160 to
160 fnd = XSEARCH(ad, fl! text$)
and try again!
Software status
===============
QL WORLD DIY TOOLKIT - MSEARCH flexible memory scanner
Version 0.8, Copyright 1993,1994 Simon N Goodwin.
Updated to match [ \ ] ^ _ £ even at start of string
V0.9, pjw, 2023 May 29, Uses table for case translation
Code split up and made Qmac and PTOOL compatible
Without prejudice to Simon N Goodwin and QL WORLD, this version is subject
to the usual..
Conditions of use and DISCLAIMER as per Knoware.no
Generated by QuickHTM, 2025 Dec 12