If you want string processing use MID$, LEFT$ which return strings (not MID ,LEFT which return Variants). Use byte processing only for binary data encoded in strings e.g. BLOBs, images from a database. Each VB string character is two bytes of Unicode data so if you process it as byte, you better know what you are doing.
john - thank you for your response. i never noticed they returned variants.
what i am doing is loading a file into a byte array. then i wanted to assign different sections of that array to other arrays. i'm doing that like this:
dim b1() as byte
dim b2() as byte
dim f as long
Dim f As Long
f = FreeFile
Open "c:\something" For Binary As #f
ReDim b1(LOF(f))
Get #f, , b1
Close #f
b2 = MidB(b1, 10, 5)
is it faster to use the arrays like this, or to use strings in a simular way?
I do not know what kind of binary data you have. if it is truly ASCII characters then read it into a string. If not, you are better off staying in the byte array. Look at StrConv function. It does a lot of stuff I'd rather not mess with as far as Unicode. If you have character data go with strings. Look also at AscW and ChrW.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.