PDA

Click to See Complete Forum and Search --> : string manipulation


Jan 21st, 2000, 01:44 AM
Private Sub Command1_Click()

Dim qwe() As Byte, asd As String

asd = "asd"

qwe = StrConv(asd, vbFromUnicode)

End Sub

so I got qwe(0) = 97
qwe(1) = 115
qwe(2) = 100

how can i do to have my string "asd" back from qwe() without looping

is there a function like strConv doing it or an API call ?

Gimpster
Jan 21st, 2000, 01:45 AM
Huh? What do you mean "have it back"?

------------------
Ryan


[This message has been edited by Gimpster (edited 01-21-2000).]

Jan 21st, 2000, 02:09 AM
I mean a function which would return "asd" based on the bytes of the qwe array

qwe = StrConv(asd,vbfromunicode) returns an
array of ascii numbers; is there a function returning a string based on an array of ascii numbers (0-255)

thank you

Gimpster
Jan 21st, 2000, 02:13 AM
I know you can use Chr() to find the letter given the Ascii code, however I do not know if it would work for an entire string of Ascii codes. You can try it. How does StrConv return the Ascii codes? Maybe you could break them up and run each one through the Chr() function.

------------------
Ryan

Aaron Young
Jan 21st, 2000, 02:14 AM
Pass the Byte Array without the Parenthesis to treat it as a String, ie.

Private Sub Command1_Click()
Dim sBytes() As Byte
Dim sString As String

sBytes = StrConv("asd", vbFromUnicode)
sString = StrConv(sBytes, vbUnicode)
End Sub



------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
ajyoung@pressenter.com