?
Solved

inttohex... and HEXTOINT ?????

Posted on 1999-12-10
5
Medium Priority
?
506 Views
Last Modified: 2012-05-05
well, the tittle says it all.. is there a function like hextoint ?
I use Dekphi 3

thanks
0
Comment
Question by:bryan7
5 Comments
 
LVL 15

Accepted Solution

by:
simonet earned 40 total points
ID: 2273261
function HexToInt(HexStr : string) : cardinal;
begin
  if HexStr[1]<>'$' then
     HexStr := '$' + HexStr;
  Result := StrToInt(HexStr);
end;

function IntToHex(AInt : cardinal) : string;
begin
  Result := Format('%x', [AInt]);
end;


Yours,

Alex

0
 
LVL 5

Expert Comment

by:scrapdog
ID: 2273493
>Result := StrToInt(HexStr);

I never knew that worked with hex...you learn something new everyday...
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 2274525
From the Delphi 4 help: (not sure it it is also in D3...)

IntToHex returns the hex representation of an integer.

Unit

SysUtils

Category

numeric formatting routines

function IntToHex(Value: Integer; Digits: Integer): string;
function IntToHex(Value: Int64; Digits: Integer): string; overload;

Description

The IntToHex function converts a number into a string containing the number's hexadecimal (base 16) representation. Value is the number to convert. Digits indicates the minimum number of hexadecimal digits to return.

Cheers,

Raymond.
0
 
LVL 3

Author Comment

by:bryan7
ID: 2275783
hey.. excellent answer Alex.. thanks !
rwilson.. thanks for your time too.. I already knew about InttoHex.. i wanted the inverse function.

btw.. alex.. where do ya live in brasil ? I've been to Rio and Sao Paulo's airports in november... !
0
 
LVL 15

Expert Comment

by:simonet
ID: 2276299
Thanks, Bryan.

I live in Belo Horizonte, Brazil 3rd largest city (after São Paulo and Rio). Belo Horizonte is 490 km North from São Paulo and 580 km East from Rio de Janeiro. It's in the state of Minas Gerais.

It's located between mountains, at 770m from the Ocean level. That makes it a very plesant city to live in. It's not as violent as Rio or SP, climate is excellent (a little rainy lately, 'though).

Next time stop by, Bryan!

Alex
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
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…
If you are looking for an automated solution for backup single or multiple Office 365 user mailboxes to Outlook data file, then you can use Kernel Office 365 Backup & Restore tool. Go through the video to check out the steps to backup single or mult…
Watch the video to learn how one can deal with PST file corruption issue with an outstanding Kernel for Outlook PST Repair Tool easily. Using this tool, non-technical users can swiftly perform the repair process to restore their essential data witho…
Suggested Courses

592 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