Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Your Blog, 5. February 2010
Message
From
12/03/2010 04:48:32
 
 
To
12/03/2010 04:03:11
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01454095
Message ID:
01454099
Views:
118
Hi Agnes,

that's some really nice addition to my code. I just opened up my Blog for anonymous comments, so if you like, you will be able to put your code in now. :-)

However, if you don't mind, I'd like to add it to my blog-function directly, too.


>Hi Thomas,
>
>I found the Text2Bin example in your blog.
>
>I found it very usefull - to convert integers to binarys.
>
>Since I have no idea how to comment your blog, I like to share the code via UT
>
>
>*betweeen
>**?lcBinString
>
>lnI   = 0x000109C1
>lcBin = Int2Bin(lnI)
>lcNib = Int2Nibble(lnI)
>lnBin = Bin2Int(lcBin)
>lnNib = Nibble2Int(lcNib)
>
>?lnI,TRANSFORM(lnI,'@0')
>?lcBin,lnBin,TRANSFORM(lnBin,'@0')
>?lcNib,lnNib,TRANSFORM(lnNib,'@0')
>
>FUNCTION Nibble2Int AS INTEGER
> LPARAMETERS;
>  tcString
>
> RETURN Bin2Int(CHRTR(tcString,' ',''))
>ENDFUNC &&Nibble2Int AS Integer
>
>FUNCTION Bin2Int AS INTEGER
> LPARAMETERS;
>  tcString
>
> RETURN INT(VAL(STUFF(TRANSFORM(0h+Bin2Char(PADL(tcString,32,'0'))),2,1,'x')))
>ENDFUNC &&Bin2Int AS Integer
>
>FUNCTION Int2Nibble AS STRING
> LPARAMETERS;
>  tiInt
>
> RETURN STUFF(STUFF(STUFF(STUFF(STUFF(STUFF(STUFF(Int2Bin(tiInt),29,0,' '),25,0,' '),21,0,' '),17,0,' '),13,0,' '),09,0,' '),05,0,' ')
>ENDFUNC &&Int2Nibble AS STRING
>
>FUNCTION Int2Bin AS STRING
> LPARAMETERS;
>  tiInt
>
> RETURN Char2Bin(EVALUATE(STUFF(TRANSFORM(tiInt,'@0'),2,1,'h')))
>ENDFUNC &&Int2Bin AS STRING
>
>*and
>**FUNCTION Char2Bin AS STRING
>
>
>
>Agnes
Best Regards
-Tom

Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.

Oh, and BTW: 010101100100011001010000011110000101001001101111011000110110101101110011
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform