I am trying to alphabetize by generating a weight of a word, saving those numbers, and then comparing which numbers are greater. Don't ask me why I need to do this way.
So I am trying to come up with a function that calculates the value of a certain word. I am using the asc function to get the ascii value, but I am not good enough at math to figure out how to calculate this.
Here is what I have. It's written in VB, but I really don't care what language, I just want to understand the algorithm.
Dim byt As Integer
Dim acc As Integer
If txt = "" Then
lbl = "0"
Else
For i = 1 To Len(txt)
byt = Asc(Mid(txt, i, 1))
acc = acc + (byt / i)
Next i
lbl = Str(acc)
End If