Solved

Hex to char convert question

Posted on 2003-10-29
4
3,132 Views
Last Modified: 2007-12-19
Hi all, win2k and delphi 6 here.

    I have a small process that receive a char, i convert it to a hex value, after that i have a convert table which tells me the new hex value. but after i'm stuck at converting back my hex value to a char. any help would be welcome.

just an exemple of where i'm stuck.

function SwapHexValue(mychar : char):char;
var
  ls_string :  string;
begin
  ls_string := inttohex(ord(mychar ),2);
  ls_string := Swap(ls_string);
  result := ???????????//something like result := hextochar(ls_string);
end;

Chad
0
Comment
Question by:Chadak
  • 3
4 Comments
 
LVL 12

Accepted Solution

by:
andrewjb earned 125 total points
ID: 9642409
Use StrToInt, with a prefix of '0x' - and it automatically oes hex conversion

i.e.

result := StrToInt( '0x' + ls_string );
0
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9642411
IntToStr('$' + ls_string );
0
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9642416
char(StrToInt('$' + ls_string ));
0
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9642429
First post was done by mistake, sorry.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Connection between libmysql.dll and MySQL Versions 7 119
select query - oracle 16 101
Delphi: sending SMS on android platform 1 64
MS Access from Delphi 31 80
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question