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:
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: