#: 14205 S10/OS9/6809 (CoCo)
05-Feb-92 19:02:27
Sb: #14197-Fonts part2
Fm: Kevin Darling 76703,4227
To: Brother Jeremy, CSJW 76477,142 (X)
Brother Jeremy,
As you've probably figured out by now, yep, SUBSTR does what you want. So I
guess the rough equivalent to search for "thisword" in A$ is:
BASIC: C = INSTR(A$,"thisword")
BASIC09: C = SUBSTR("thisword",A$)
Now, if you have to start the search at a certain position, then you can use
MID$ to get there, but have to add back the starting offset if found:
STARTPOS = 5
BASIC: C = INSTR(STARTPOS,A$,"thisword")
BASIC09: C = SUBSTR("thisword",MID$(A$,STARTPOS,100))
IF C0 THEN C=C+STARTPOS-1 \ ENDIF
I believe these are equivalent... but test to be sure. BTW, the "100" was
arbitrarily picked as the max size of any string. You may (or may not) need to
change that. Depends on how large A$ can be. If the string is smaller, it'll
just ignore the extra amount, and all will be okay.
best - kevin
|