For some reason, I have this stub of code that I (or somebody else) might have added a long time ago for some basic encryption-ish, idk.
Code: Select all
PUBLIC FUNCTION trimOdds(oldStr As STRING) AS STRING
DIM AS STRING newStr = STRING(LEN(oldStr) / 2," ")
DIM ii AS INTEGER
FOR i AS INTEGER = 0 TO LEN(oldStr) STEP 2
newStr[ii] = CHR(oldStr[i])
ii = ii + 1
NEXT
RETURN newStr
END FUNCTION
What it does is it takes the chars from even-numbered index. ex: "
HZEDLTLHOM" would supposedly return "
HELLO", if I remember correctly.
It was working fine with FBC 0.24, but not in 0.90.1 as I'm getting an:
Code: Select all
error 169: Invalid assignment/conversion in `newStr[ii] = CHR(oldStr[i]))'
I know I could write some other routine arriving in the same result back when it was working but I'd like to know the rationale why it's not working now to avoid same errors in the future.
~creek23