Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Your Blog, 5. February 2010
Message
De
12/03/2010 09:49:55
 
 
À
12/03/2010 04:48:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01454095
Message ID:
01454163
Vues:
62
I don't read German (even when I could understand and speak it somewhat back in the 80s I couldn't really read it) :o), however, I get it "enough" to be happy that my sig had anything to do with your writing that code. It's soooooooooooo cool! Thanks for sharing (and thanks to Agnes for the additions)! (I noticed you changed the binary to translate :o)



>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
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform