Convert hex string to ansistring in Delphi 2010?

Besides the solutions others provided, you can also make use of the built-in function.

Besides the solutions others provided, you can also make use of the built-in function: function HexStrToStr(const HexStr: string): string; var tmp: AnsiString; begin Assert(not Odd(Length(HexStr)), 'HexToStr input length must be an even number'); SetLength(tmp, Length(HexStr) div 2); HexToBin(PWideChar(HexStr), @tmp1, Length(tmp)); result := tmp; end; This implementation assumes that the hex-encoded string has been an Ansistring in the first place. For flexibility I suggest to use TBytes instead.

2 +1 Why roll your own when you can use a built-in – David Heffernan Mar 6 '11 at 12:27 @David, because the built-in doesn't handle uppercase A-F. – Cosmin Prund Mar 6 '11 at 13:37 @Cosmin then just throw in a call to UpperCase! – David Heffernan Mar 6 '11 at 13:38 @Cosmin, at least in Delphi XE it doesn't matter what you throw in.

HexToBin handles lowercase letters as well as uppercase ones. – Uwe Raabe Mar 6 '11 at 14:52 1 @Cosmin, the latest help reads the same way but you can draw Embarcadero's attention to this by leaving comments on the discussion tab for that page. – LachlanG Mar 6 '11 at 22:26.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions