S*Basic String Parsing Toolkit

            A number of string-related functions to help with
                            parsing text strings

They should be compatible with Qdos, Minerva and SMSQ/E, although, since
they use internal routines for some capabilities, there may be small
differences in their results depending on the OS used. Most of these
commands will be compatible with popular S*BASIC compilers, except in cases
where results are returned via the parameters. In some cases a small speedup
could have been achieved by writing them specifically for compilers and
SMSQ/E. Well, you have the source code, so its still possible to do that,
if you can and choose!

        Take the fiddle out of string slicing with these handy commands!

Common parameter usage:

        if start% > end% the parameters are reversed
        if end% < 1 or start% > len, no action taken (see individually)
        if start% < 1 start set to 1
        if end% > len, end set to len

s$ = REMOVE$(start%, end%, string$)
        Copys string$ into s$, with chars start% to end%, inclusive, removed.
        If start% & end% outside range, string is returned intact

s$ = EXTRACT$(start% to end%, string$)
        Extracts slice of string$ from start% to end%
        If start% & end% outside range, a nul string is returned

s$ = INSERT$(at%, substring$, mainstring$)
        Inserts a substring in mainstring after position at%
        If at% < 0: at% = 0. If at% > len(mainstring$): at% = len

Programmers notes:
Not all functions will be required in all cases in compiled programs,
therefore they have been re-written in a relatively modular fashion, so
that unwanted commands and their functional code may easily be removed. See
the link files for details. Most individual commands can be compiled on
their own, but since they rely on common library files, they may be
relatively bulky. If only one or two commands are required in a compiled
program, it is often better to omit the library files and insert your own
routines, eg to fetch and return parameters, etc.

Note: These commands dont share much code except for the initial parameter
parsing code.

Note: I had so much trouble modernising the INSERT$ code that I decided to
revert to some ancient code that, although bulky, inefficient, and not
very pretty, actually works! It may get "fixed" some day..

Software status
V0.01, pjw, 10 Mar 2001
V0.02, pjw, 16 Nov 2003, various times: improvements and additions
V0.03, pjw, 21 May 2019, modularised and improved
V0.04, pjw, 2020 Feb 18, added back INSERT$ using ancient, original code

You may use these routines in your own QL-related programs, provided you
suitably and proportionally accredit the author(s). See otherwise the
conditions set out on my web site www.knoware.no