Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Conversion to hex?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual ProMatrix
Divers
Thread ID:
00529304
Message ID:
00529338
Vues:
11
>>Is there a way in VFP to convert a string to a hex value?
>>like if I get the string "<]" to convert it to "0xC35D"?
>

>
>FUNCTION str2hex
>  LPARAMETERS pcStr
>
>  LOCAL lnCnt, lcHex
>
>  lcHex = ""
>  lnCnt = len(pcStr)
>  DO WHILE lnCnt > 0
>    lcHex = RIGHT(TRANSFORM(ASC(SUBSTR(pcStr, lnCnt, 1)), "@0"), 2) + lcHex
>    lnCnt = lnCnt - 1
>  ENDDO
>
>  return iif(!empty(lcHex), "0x"+lcHex, "")
>ENDFUNC
>
>
> Not tested, but hope it helps,

For the working version see FAQ#7909.
:)
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform