04-26-2024, 01:08 PM
(This post was last modified: 04-26-2024, 01:09 PM by Circlotron.)
(04-26-2024, 07:23 AM)euklides Wrote: Pete wrote:Disregarding the lost letters mentioned above, what if we adjust the for/next values so we can eliminate two additions that repeat every loop? Would that speed things up a little, or are the calculation results cached somehow so that recalcs are not needed?
a$ = "uncopyrightable"
For i = 1 To 26
If InStr(LCase$(a$), Chr$(96 + i)) Then Print Chr$(96 + i);
Next
Ok, very short.
But, if the word has the same letter twice (or more), some of them are lost if the final result must have the same length.
a$ = "uncopyrightable"
For i = 97 To 122
If InStr(LCase$(a$), Chr$(i)) Then Print Chr$(i);
Next