Converting Decimal to Hex (REALbasic getting started Mailinglist archive)

Back to the thread list
Previous thread: Running Program from CD-ROM
Next thread: Question on 2DDraw


RB Database   -   tom.russell transport.alstom.com
  Converting Decimal to Hex   -   Barrie Jones
   Re: Converting Decimal to Hex   -   Norman Palardy
   Re: Converting Decimal to Hex   -   Barrie Jones

Converting Decimal to Hex
Date: 02.05.06 00:25 (Mon, 1 May 2006 19:25:15 -0400)
From: Barrie Jones
When converting from decimal to hex, is there a way to define the
number of returned hex characters?
Currently I am checking the length of the Hex string and adding the
required number of 0 characters.
Barrie
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Converting Decimal to Hex
Date: 02.05.06 00:38 (Mon, 1 May 2006 17:38:13 -0600)
From: Norman Palardy

On May 01, 2006, at 5:25 PM, Barrie Jones wrote:

> When converting from decimal to hex, is there a way to define the
> number of returned hex characters?
> Currently I am checking the length of the Hex string and adding the
> required number of 0 characters.
> Barrie

No.

Something like

hexString eft("00", 2 - len(hex(VALUE))) + hex(VALUE)

should give you a hex string that is always 2 characters long for
each VALUE

(this may have errors as I just wrote it in the email)

If you want more digits change the 2 to how ever many digits you
want, and the "00" to the same number of repeated 0's


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Converting Decimal to Hex
Date: 02.05.06 00:44 (Mon, 1 May 2006 19:44:02 -0400)
From: Barrie Jones
Thank you for your quick reply. Saved me a lot of research time.
Barrie
On May 1, 2006, at 7:38 PM, Norman Palardy wrote:

>
> On May 01, 2006, at 5:25 PM, Barrie Jones wrote:
>
>> When converting from decimal to hex, is there a way to define the
>> number of returned hex characters?
>> Currently I am checking the length of the Hex string and adding
>> the required number of 0 characters.
>> Barrie
>
> No.
>
> Something like
>
> hexString 6eft("00", 2 - len(hex(VALUE))) + hex(VALUE)
>
> should give you a hex string that is always 2 characters long for
> each VALUE
>
> (this may have errors as I just wrote it in the email)
>
> If you want more digits change the 2 to how ever many digits you
> want, and the "00" to the same number of repeated 0's
>
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
> Search the archives of this list here:
> <http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>





Links
MBS Realbasic tutorial videos - Pfarrgemeinde Messdiener Nickenich