DAY 032: _INSTRREV
#3
This was badly needed in QuickBASIC, although many more years would pass before there were enough users of Linux that searching from the end of a string to the beginning for a "slosh" became necessary.

I have yet to see in somebody else's source code this function replicated by reversing a string, using "INSTR" and then creating a return integer offset. OTOH reversing a string required some performance penalty.

I had thought "FilenamePart" function in Purebasic was a "black box". (It returned only the eight characters or less of an "8-dot-3" MS-DOS-style filename, or the similar portion between the last "slosh" and the period that separates it from the suffix.) But what it did, wound up being used in a lot of my programs for that system. I worked on an emulation of that function for QB64. I wound up doing a "stringfieldseg" which does the "_INSTRREV" thing for either slash and then returns the rest of the string which is assumed to be a filename.

EDIT: Got ninja'ed by vince, and he was able to tell before me what I said in the second paragraph. :tu:
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: 4 Guest(s)