From: bcb on
....is it possible?

I have a desire to do the following...

dim b() as byte ' for interoperability issues it needs to be bytes
b="abc"

Which works, except that when I examine b it is [97 0 98 0 99 0] not
[97 98 99] as I expected...

Short of writing some code to remove the 0's, is there a "better way" to
accomplish what I want?

Thanks!
Bruce



From: Jim Mack on
bcb wrote:
> ...is it possible?
>
> I have a desire to do the following...
>
> dim b() as byte ' for interoperability issues it needs to be bytes
> b="abc"
>
> Which works, except that when I examine b it is [97 0 98 0 99 0] not
> [97 98 99] as I expected...
>
> Short of writing some code to remove the 0's, is there a "better
> way" to accomplish what I want?

b = StrConv("abc", vbFromUnicode)

--
Jim Mack
Twisted tees at http://www.cafepress.com/2050inc
"We sew confusion"

From: Dee Earley on
On 16/04/2010 20:59, Jim Mack wrote:
> bcb wrote:
>> ...is it possible?
>>
>> I have a desire to do the following...
>>
>> dim b() as byte ' for interoperability issues it needs to be bytes
>> b="abc"
>>
>> Which works, except that when I examine b it is [97 0 98 0 99 0] not
>> [97 98 99] as I expected...
>>
>> Short of writing some code to remove the 0's, is there a "better
>> way" to accomplish what I want?
>
> b = StrConv("abc", vbFromUnicode)

Note that this is converting TO DBCS/MBCS (With potential data loss
depending on codepages).
The original version you quoted was UCS-2 (unicode)

--
Dee Earley (dee.earley(a)icode.co.uk)
i-Catcher Development Team

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)