Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Your Blog, 5. February 2010
Message
 
 
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:
01454131
Views:
63
Agnes,

If you make a reference to the blog, then why you didn't provide a link?

>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
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform