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
Solved

Hex to char convert question

Posted on 2003-10-29
4
3,131 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

860 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