converting short to unicode without System.Text.UnicodeEncoding

G

Guest

hi, how can i convert type Short to Unicode strings? the
System.Text.UnicodeEncoding cant convert it if the length is too shrot....so
i need to do this manually. how can i do this
 
S

Steven Nagy

Aren't strings in dotnet in unicode by default?

Thus:
Dim s as short = 5
Dim u as string = CType(s, integer).ToString()

Or am I completely missing the point here?
 
L

Larry Lard

iwdu15 said:
hi, how can i convert type Short to Unicode strings? the
System.Text.UnicodeEncoding cant convert it if the length is too shrot....so
i need to do this manually. how can i do this

What do you mean? Values of type Short are numbers - do you just want
their decimal representations? All .NET Strings are Unicode, so you
just need to say

Dim myShort As Short = 5
Dim myString As String = myShort.ToString


Encodings are for translating between bytes and characters.
 
H

Herfried K. Wagner [MVP]

iwdu15 said:
hi, how can i convert type Short to Unicode strings?

I am not sure what you want to archieve, but maybe 'ChrW(x)' is what you are
looking for. Note that Microsoft unfortunately uses the term Unicode
instead of UTF-16. Strings are stored as UTF-16 in .NET.
 
G

Guest

thanks, what im trying to o is read in header information from WMA and MP3
files. i did some reading on it and the websites i went to said that the .NET
functions for to Unicode characters needed a length of atleast 256 bytes....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top