Results 1 to 5 of 5

Thread: string manipulation

  1. #1
    Guest

    Post

    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 ?




  2. #2
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    Huh? What do you mean "have it back"?

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


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

  3. #3
    Guest

    Post

    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

  4. #4
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    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

  5. #5
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    Pass the Byte Array without the Parenthesis to treat it as a String, ie.
    Code:
    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
    [email protected]
    [email protected]


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width