DAY 032: _INSTRREV
#5
String = "fi neht evetS lluf retfa ro og evetS hcum"

SubString$ = "evetS"

You have two different instances of the SubString, so is your goal to count from left to right or right to left?

Well, I would look at it this way...

Code: (Select All)
$CONSOLE:ONLY
DEFLNG A-Z

LINE INPUT "Search term: "; p$

s$ = "much Steve go or after full Steve then if"
PRINT s$
PRINT INSTR(s$, p$)
PRINT _INSTRREV(s$, p$)
PRINT resteve$(s$)
j = insteve(s$, p$)
LOCATE , j: PRINT "^"
COLOR 14: PRINT j: COLOR 7, 0
SLEEP
RUN

FUNCTION insteve (a$, b$)
    insteve = INSTR(resteve$(a$), resteve$(b$))
END FUNCTION

FUNCTION resteve$ (a$)
    b$ = ""
    FOR i = 1 TO LEN(a$)
        b$ = b$ + MID$(a$, LEN(a$) - i + 1, 1)
    NEXT
    resteve$ = b$
END FUNCTION

Pete
If eggs are brain food, Biden takes his scrambled.
Reply


Messages In This Thread
DAY 032: _INSTRREV - by Pete - 12-12-2022, 08:58 PM
RE: DAY 032: _INSTRREV - by vince - 12-12-2022, 09:10 PM
RE: DAY 032: _INSTRREV - by mnrvovrfc - 12-12-2022, 09:10 PM
RE: DAY 032: _INSTRREV - by vince - 12-12-2022, 09:39 PM
RE: DAY 032: _INSTRREV - by Pete - 12-12-2022, 10:20 PM
RE: DAY 032: _INSTRREV - by vince - 12-13-2022, 12:03 AM
RE: DAY 032: _INSTRREV - by Pete - 12-13-2022, 01:35 AM
RE: DAY 032: _INSTRREV - by vince - 12-13-2022, 02:02 AM
RE: DAY 032: _INSTRREV - by SMcNeill - 12-13-2022, 09:34 AM
RE: DAY 032: _INSTRREV - by mnrvovrfc - 12-13-2022, 11:16 AM
RE: DAY 032: _INSTRREV - by SMcNeill - 12-13-2022, 09:43 AM
RE: DAY 032: _INSTRREV - by Pete - 12-13-2022, 02:52 PM



Users browsing this thread: 2 Guest(s)