Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
STR2HEX e HEX2STR...
Message
From
03/09/2004 20:34:45
 
 
To
03/09/2004 18:20:07
Peter Wagner
Point Informática Ltda.
Limeira, Brazil
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00939373
Message ID:
00939394
Views:
9
>É preguiça (sexta feira pô) e falta de tempo, portanto...
>Allguem por ai teria para disponibilizar uma função p/ converter de String p/ Hexadecimal e vice-versa ?
>ou uma DLL que faça isto e onde posso obter.
>Agradeço antecipadamente.

Zé preguiça.. Me explica o seguinte:

É preguiça ou falta de tempo ? Estas duas afirmações não se "bicam" não.. O preguiçoso tem todo o tempo do mundo..

Bem.. Mais de qualquer maneira ai vai "o troço":

:P
? "          ",  hex(ASC("A"))
? "           ", chr(dec("41"))

FUNCTION hex
PARAMETERS l1int
PRIVATE l1loop,l1hex,l1str
l1str='0123456789ABCDEF'
l1hex=''
FOR l1loop=7 TO 0 STEP -1
    l1part=INT(l1int/(16^l1loop))
    l1hex=l1hex+SUBSTR(l1str,l1part+1,1)
    l1int=l1int-l1part*(16^l1loop)
ENDFOR
DO WHILE LEFT(l1hex,1)='0'.and.len(l1hex)>1
    l1hex=SUBSTR(l1hex,2)
ENDDO
RETURN l1hex

FUNCTION dec
PARAMETERS l1hex
PRIVATE l1loop,l1int,l1str,l1ctr
l1str='0123456789ABCDEF'
l1int=0
FOR l1loop=LEN(l1hex)-1 TO 0 STEP -1
    l1int=l1int+(16^l1loop)*(AT(SUBSTR(l1hex,LEN(l1hex)-l1loop,1),l1str)-1)
ENDFOR
RETURN l1int
flw

Claudio
"Now to him who is able to do immeasurably more than all we ask or imagine, according to his power that is at work within us, Ephesians 3:20
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform