Delphi character count

Reply

Join Date: May 2007
Posts: 3
Reputation: wesley123456789 is an unknown quantity at this point 
Solved Threads: 0
wesley123456789 wesley123456789 is offline Offline
Newbie Poster

Delphi character count

 
0
  #1
May 14th, 2007
Hello new to this site - looking for help counting specific characters from a single word input by a text box,

Thanks
Wes
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 171
Reputation: radu84 is an unknown quantity at this point 
Solved Threads: 16
radu84 radu84 is offline Offline
Junior Poster

Re: Delphi character count

 
0
  #2
May 14th, 2007
probably length. what you're using? editbox,memo,etc?
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 1
Reputation: tnyoni is an unknown quantity at this point 
Solved Threads: 0
tnyoni tnyoni is offline Offline
Newbie Poster

Re: Delphi character count

 
0
  #3
May 14th, 2007
Hi,
I am new to delphi and I have a delphi designed dos point of sale program.
I need assistance to open the program for a small reward.
If you are interested I can mail you the executables and further instructions.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 3
Reputation: wesley123456789 is an unknown quantity at this point 
Solved Threads: 0
wesley123456789 wesley123456789 is offline Offline
Newbie Poster

Re: Delphi character count

 
0
  #4
May 14th, 2007
i am using an edit box with a single word,
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 171
Reputation: radu84 is an unknown quantity at this point 
Solved Threads: 16
radu84 radu84 is offline Offline
Junior Poster

Re: Delphi character count

 
0
  #5
May 14th, 2007
procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage(inttostr(length(trim(edit1.Text))));
end;
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 3
Reputation: wesley123456789 is an unknown quantity at this point 
Solved Threads: 0
wesley123456789 wesley123456789 is offline Offline
Newbie Poster

Re: Delphi character count

 
0
  #6
May 14th, 2007
thank you but this gives the total length of the text - if 'barbara' is entered and the character is 'a' - the result must be 3

your help appreciated
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 171
Reputation: radu84 is an unknown quantity at this point 
Solved Threads: 16
radu84 radu84 is offline Offline
Junior Poster

Re: Delphi character count

 
0
  #7
May 15th, 2007
Originally Posted by wesley123456789 View Post
thank you but this gives the total length of the text - if 'barbara' is entered and the character is 'a' - the result must be 3

your help appreciated
this is very simple, i'll give you the answer but i'm not sure how much you'll learn.

counter:=0;
for i:=1 to length(s) do
if s[i]=your_character then
inc(counter)
Last edited by radu84; May 15th, 2007 at 1:25 am.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Pascal and Delphi Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC