Solved

Hex to char convert question

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

762 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now