Solved

converting integer to ascii

Posted on 2000-04-03
9
466 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
Comment Utility
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
Comment Utility
Use

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


Regards,

Eps.
0
 
LVL 9

Expert Comment

by:ITugay
Comment Utility
Epsylon;)
Ooops....
0
 
LVL 13

Expert Comment

by:Epsylon
Comment Utility
Instead of defining value as Byte, you can also define it as Integer, but Chr only accept values from 0 to 255.
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 13

Expert Comment

by:Epsylon
Comment Utility
:o)

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

Expert Comment

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

Expert Comment

by:ptmcomp
Comment Utility
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
Comment Utility
>LOCK<
0
 
LVL 13

Accepted Solution

by:
Epsylon earned 100 total points
Comment Utility
>LOCK<
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
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…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

772 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

10 Experts available now in Live!

Get 1:1 Help Now