Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[Help] [Delphi] Check if letters or digits entered?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
YellowEye
How do I cheat?
Reputation: 0

Joined: 18 Dec 2008
Posts: 5

PostPosted: Thu Feb 05, 2009 7:20 am    Post subject: [Help] [Delphi] Check if letters or digits entered? Reply with quote

Hello, I want to ask all of you, if someone knows how to check if letters (characters) - for example A,B,C... or digits(numbers) - for example 1,2,3 ... or both of them (characters and numbers) - for example A,1,B,2 are typed in edit1.

If you don't understand: I have edit1 and a button1. So here is my question: If I press the button1, I want to see a messagebox which says "In your edit1 you have typed only characters Smile " or "In your edit1 you have typed only letters Smile " Cool
Can someone help me with source code? Thank you. Rolling Eyes
Back to top
View user's profile Send private message
NothingToShow
Grandmaster Cheater Supreme
Reputation: 0

Joined: 11 Jul 2007
Posts: 1579

PostPosted: Thu Feb 05, 2009 8:26 am    Post subject: Reply with quote

Found a function on the internet, dunno if it works.

isDigit
Code:

function isDigit(ch: char): boolean;
begin
  if ch in ['0'..'9'] then
    isDigit := true
  else
    isDigit := false;
end;
Back to top
View user's profile Send private message
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Thu Feb 05, 2009 8:41 am    Post subject: Reply with quote

Clopin wrote:
Found a function on the internet, dunno if it works.

isDigit
Code:

function isDigit(ch: char): boolean;
begin
  if ch in ['0'..'9'] then
    isDigit := true
  else
    isDigit := false;
end;


Why post something you don't know what it is and idioticly not answering his question ?

what you posted checks a specific char within the range 0 to 9.

Edit: to answer your question, manipulate the string entered in the Text Box by seperating each char and comparing.
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Thu Feb 05, 2009 10:25 am    Post subject: Reply with quote

what are you using the fetch the string ? GetDlgItemText ? if so, the return value is number of characters copied to the buffer.
Back to top
View user's profile Send private message
Tsabo
Cheater
Reputation: 0

Joined: 03 Feb 2009
Posts: 44
Location: Texas

PostPosted: Sun Feb 08, 2009 8:21 pm    Post subject: Reply with quote

Use the TryStrToInt routine found in the SysUtils unit provided by CodeGear. Here is an example that utilizes that routine.

Code:
function IsNumeric(const AValue: string): Boolean;
var
  Value: Integer;
begin
  Result := TryStrToInt(AValue, Value);
end;

Regards
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites