?
Solved

converting integer to ascii

Posted on 2000-04-03
9
Medium Priority
?
472 Views
Last Modified: 2010-04-04
hi,
i want to be able to enter any number from 0 to 200 and i want to get the ascii character corrosponding to that number. how do can i do this? converting into bytes is ok as well but you would have to be explicit, i haven't used bytes before. how do i define a variable as a byte? but in the end i would prefer to do it without using bytes. so to reiterate, i want to be able to take an integer and get the ascii character that integer represents. please help.
thank you.
0
Comment
Question by:twilight_prince
[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
9 Comments
 
LVL 9

Expert Comment

by:ITugay
ID: 2679916
Let suppose you have two TEdit controls on your form.
First - where you type number (0..200)
Second - where you want to see a char.
then you need code
------
begin
   Edit2.Text:=Char(StrToInt(Edit1.Text));
end;
-----
Cheers,
Igor.
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2679926
Use

Var
  value: Byte;
Begin
  value := 65;
  Label1.Caption := Chr(value);
End;


Regards,

Eps.
0
 
LVL 9

Expert Comment

by:ITugay
ID: 2679935
Epsylon;)
Ooops....
0
Independent Software Vendors: 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!

 
LVL 13

Expert Comment

by:Epsylon
ID: 2679937
Instead of defining value as Byte, you can also define it as Integer, but Chr only accept values from 0 to 255.
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2679942
:o)

We don't have the same answer, but I'll withdraw mine...
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 2680944
its all said
chr() is the function you need
0
 
LVL 10

Expert Comment

by:ptmcomp
ID: 2685494
In Delphi all ordinal types are compatible:

var
  b: Byte;
  i: Integer;
  m: 1..1000;
  i64: Int64;
begin
  b:=3;
  i:=b; m:=i; i64:=m;
  ....
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2688230
>LOCK<
0
 
LVL 13

Accepted Solution

by:
Epsylon earned 400 total points
ID: 2688231
>LOCK<
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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

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