Results 1 to 2 of 2

Thread: [VB] Unicode

  1. #1
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 02
    Location
    Finland
    Posts
    6,653

    [VB] Unicode

    VB Code:
    1. 'convert to UTF-16
    2.             For A = 1 To Len(Temp) Step 2
    3.                 Text = Text & ChrW(Asc(Mid$(Temp, A, 1)) + Asc(Mid$(Temp, A + 1, 1)) * 256)
    4.             Next A

    Yup. If someone knows a better way, you'll become my hero. I want to make optimal code for the class module I'm working with, and this is the weakest code there atm.

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 01
    Location
    In a microchip!
    Posts
    11,594
    Write a DLL in C. VB's strings are UTF-16 internally, but accessing them that way...


    You could try a fixed length string (length = Len(Temp) / 2), and the CopyMemory API call. Quite risky though.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

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