Solved

converting integer to ascii

Posted on 2000-04-03
9
469 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
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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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 100 total points
ID: 2688231
>LOCK<
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
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…

827 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