Solved

Hex to char convert question

Posted on 2003-10-29
4
3,133 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: 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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

752 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