[Gambas-user] Byte conversion

Jesus ea7dfh at ...2382...
Sun Nov 25 16:27:28 CET 2012


El 25/11/12 14:45, Tobias Boege escribió:
> On Sun, 25 Nov 2012, Jesus wrote:
>> Hi
>>
>> Im trying to do some kind of conversion but can't get it done.
>>
>> In python I do:
>>
>> ord(str("\x01"))
>>
>> Which returns 1 as an integer
>>
>> How could I get this done in Gambas3?
>>
>> This is what I've tried:
>>
>> Asc(Cint(Str("\x01")))
>>
>> but no luck. Seems there is not an specialized function to do the byte
>> conversion.
>>
>> Any clue?
>>
>> Regards
>> --
>> Jesus Guardon
>
> What do you want to do exactly?
>
> If in place of "\x01" there is a variable string and you want the first byte
> in that string, then do CByte(Asc(sStr)).
>
> Regards,
> Tobi

I've figured it out playing with several combinations. Finally this is 
what I needed.

Many thanks, anyway.


-- 
Jesus Guardon




More information about the User mailing list