SC gettokenindex - new ALL or NOT switch

Features wanted...
Post Reply
klownboy
Posts: 2828
Joined: 28 Feb 2012 19:27

SC gettokenindex - new ALL or NOT switch

Post by klownboy » 04 Dec 2019 16:21

Hi Don, would it be possible to have a new "inverted/not/all[a]" switch for SC gettokenindex such that it would determine if the token type is either every entry in the tokenlist or not every entry in the tokenlist. It would work all by itself or possibly with the existing count 'c' switch.

So for example, if I want to find out if all the selected files are a particular file type like JPG, I could apply gettokenindex("*.jpg", $images, <crlf>, 'aiwc') with a new 'a' switch and if the selected file listing (tokenlist) contains a BMP file (or any other type file) other than "*.JPG" token, the return for SC gettokenindex would return a -1 (or whatever you deem appropriate) - informing us that not all items in the tokenlist are the token type. If every file was a .JPG file then the return could possibly be the normal count return. Now there are other ways to accomplish this, yes but, they all involve a 2 or 3 lines of code as oppose to one. It seems like it would be a good fit for gettokenindex. For additional background, you may have seen this thread viewtopic.php?f=3&t=21221. Thanks.

Post Reply