• Earn real money by being active: Hello Guest, earn real money by simply being active on the forum — post quality content, get reactions, and help the community. Once you reach the minimum credit amount, you’ll be able to withdraw your balance directly. Learn how it works.

Delphi [Función] HexStrToHex by Metal

Status
Not open for further replies.

Expermicid

Leech
User
Joined
Oct 23, 2011
Messages
285
Reputation
0
Reaction score
255
Points
63
Credits
0
‎13 Years of Service‎
95%
Función:

[lenguaje=delphi]Function HexStrToHex(HexStr: string): string;

var

i: integer;

Impares, Pares: char;

begin

for i:= 1 to Length(HexStr) div 2 do

begin

Impares:= HexStr[2 * i - 1];

Pares:= HexStr[2 * i];

if i < Length(HexStr) div 2 then

Result:= Result + '$' + Impares + Pares + ','

else

Result:= Result + '$' + Impares + Pares;

end;

end;[/lenguaje]

Ejemplo de uso con una cadena de varios valores hexadecimales:

[lenguaje=delphi]Showmessage (HexStrToHex('4D535642564D36302E444C4C'));

//Nos devolverá $4D,$53,$56,$42,$56,$4D,$36,$30,$2E,$44,$4C,$4C [sin coma al final][/lenguaje]

Ejemplo de uso con una cadena de un valor hexadecimal:

[lenguaje=delphi]Showmessage (HexStrToHex('4D'));

//Nos devolverá $4D [También sin coma final][/lenguaje]

Credito: Metal_Kimgdom

 
Last edited by a moderator:
Status
Not open for further replies.
Back
Top