How to do this using Delphi

Status
Not open for further replies.

milan.rajik

Banned
Joined
Apr 1, 2013
Messages
2,524
Helped
540
Reputation
1,078
Reaction score
524
Trophy points
1,393
Visit site
Activity points
0
I am using RAD Studio XE6. I want to know how to extract characters from a Edit Box that is I have something like EDABoard in EditBox and I want to extract one character at a time from the EditBox like 'E', 'D', 'A', .... and also want to get the ascill value of the charcaters of each extracted characters.
 

The entire content of the EditBox is held in its Text property like this: EditBox1.Text
To get one character from that just use an index. EditBox1.text[1] is the first character in the string.
To get the ASCII value of a character use the ord function.
So you could have something like this:

Code:
var
  ASCII_Val : byte;
  i : integer;
begin
  for i := 1 to length(Edit1.Text) do
  begin
    ASCII_Val := ord(Edit1.Text[i]);
    // Do whatever you want with the ASCII value here
  end;
end;
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…