Oh, I thought you were accusing me of nitpicking your code, while I was having questions about almost all lines of my code in conjunction with legacy FoxPro, blame me. You don't want to dig into it, okay. It's just a pitty your code is so brute force, that it hurts. I'm used far better code from your FAQs. Please take the compliment out of that rather than the criticism. If you're fine with your own function now, you are. As simple as that.
Nope, not accusing you of anything. Once I saw parts of your code that will not work for me, I quit examining your code. Compared to most code I see posted, yours looks a lot like plain jane FP code, so with a little time I could probably modify it to work in FP 2.6.
Sometimes when I see VFP code my eyes blur over because what I tend to see is code bloat. Since I have never been able to migrate to VFP, trying to understand exactly what is happening is often overwhelming. I just watch, then jump in when there is something I can contribute.
Obviously, VFP must be better and easier to use, else no one would have migrated voluntarily. It just does not seem that way to me. And for me, VFP will never be an option.
As far as the code I wrote and posted, it definitely is brute force. I prefer simple concise solutions that never fail. I did a quick and dirty from a different angle, then massaged it into something that could be used. Will I ever use it? No idea. But it goes into my code closet just in case. And since it works, although probably slower than other solutions, no big deal outside of loops, I do not see any reason to do any more tinkering with it. I am sure with a little thought, and study of other solutions, I could come up with something better and/or faster. Not a one liner for sure, although that would tickle me pink if I could find a way.
And, by the way, the qOutType parameter check I did in the code I posted is some of the worst code I have written. I did everything backwards there, opposite of what I normally do. I caught the insanity before I filed the function away for future use, but was unable to edit the post to change those 3 lines of code.
My coding style is the result of years of Apple BASIC coding on a 16k, 1mhz machine. Variable uniqueness maxed out at 2 characters, every single byte counted, and garbage collection was a fact of life, forcing me to code outside of the box, often doing things that others said were impossible. They say recursion is impossible in Apple BASIC, but I found a way to do it when I crunched a 250-line shell sort program down to 3 lines of code while at the same time speeding it up, i.e. a 12 minute sort wound up being a 12 second sort.
Using an Apple II+, I published over 200 inhouse technical reference booklets (10-30 pages each), all different, all formatted and published using Apple BASIC, some of which I still use. I also published 2 technical reference manuals (8" x 11" x 200+ pages) that I sold for $100 each in the early and mid 90s using that machine.