?
Solved

Represent UCS2 string in my VB app?

Posted on 2003-03-29
3
Medium Priority
?
472 Views
Last Modified: 2010-05-01
Hi all,
I have a UCS2 encoded string "062C064506390629". How can I represent it as string in VB??
0
Comment
Question by:alkait
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Accepted Solution

by:
stretch71 earned 120 total points
ID: 8235326
UCS2 is the same as UTF16 which is Unicode on Windows.

To do the conversion, you need to split the string into chunks of 4 characters and convert each into a unicode character.

Step 1.  Split the string into chunks, then in a loop...
Step 2.  Convert each hex chunk to a long
Step 3.  Use ChrW to get the unicode character
Step 4.  Put the character on the end of your result string.

For step 2, the code is very simple

dim l as long
l = clng("&H" & hexchunk)

The rest I will let you work out yourself, but it's very easy code.
0
 

Expert Comment

by:CleanupPing
ID: 8531333
Hi alkait,
This old question (QID 20567826) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
 
LVL 6

Expert Comment

by:GPrentice00
ID: 9440666
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

 -->Accept stretch71's comment as Answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER

GPrentice00
Cleanup Volunteer
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question