Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Alphabetical sort of characters within a string.
#48
(04-27-2024, 01:46 PM)bplus Wrote:
(04-27-2024, 02:42 AM)SMcNeill Wrote:
(04-27-2024, 01:44 AM)bplus Wrote: studying steves string addition, i came up with a way to crack peteCode2

...

i honestly thought it wouldn't work but it did.

Bada Bing!! You're welcome, oh ye of little faith. Big Grin

Now your code is beginning to look more like the one which I shared from the beginning for you. it would also complain of the same "invalid value"

Big Grin Big Grin Wink

+1 ok this has been quite an adventure past couple days

i would probably have been onto it quicker had you shared the file you were using with code in zip but still a hard won lesson will be likely remembered better/longer.

i wonder if that trick will help the other version of anaCode with all the letter counts or PeteCode ?

ah altAnaCode$ now edges out PeteCode2$ barely
Code: (Select All)
Function altAnaCode$ (wrd$) ' anaCode$ converts word to an Anagram pattern
    Dim As Integer L(65 To 90), i, p
    Dim t$(65 To 90)
    Dim rtn$, w$
    w$ = UCase$(wrd$) ' don't assume all caps  as expected
    For i = 1 To Len(w$)
        p = Asc(w$, i) ' A=1, B=2...
        L(p) = L(p) + 1
    Next
    For i = 65 To 90
        t$(i) = LTrim$(Str$(L(i)))
    Next
    altAnaCode$ = bind$(t$())
End Function

can petecode2$ also benefit from bind$ trick? it seems like it will be going backwards?
b = b + ...
Reply


Messages In This Thread
RE: Alphabetical sort of characters within a string. - by bplus - 04-27-2024, 03:18 PM



Users browsing this thread: 5 Guest(s)