944,101 Members | Top Members by Rank

Ad:
May 14th, 2007
0

Delphi character count

Expand Post »
Hello new to this site - looking for help counting specific characters from a single word input by a text box,

Thanks
Wes
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
wesley123456789 is offline Offline
3 posts
since May 2007
May 14th, 2007
0

Re: Delphi character count

probably length. what you're using? editbox,memo,etc?
Reputation Points: 14
Solved Threads: 16
Junior Poster
radu84 is offline Offline
171 posts
since Dec 2006
May 14th, 2007
0

Re: Delphi character count

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
tnyoni is offline Offline
1 posts
since May 2007
May 14th, 2007
0

Re: Delphi character count

i am using an edit box with a single word,
Reputation Points: 10
Solved Threads: 0
Newbie Poster
wesley123456789 is offline Offline
3 posts
since May 2007
May 14th, 2007
0

Re: Delphi character count

procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage(inttostr(length(trim(edit1.Text))));
end;
Reputation Points: 14
Solved Threads: 16
Junior Poster
radu84 is offline Offline
171 posts
since Dec 2006
May 14th, 2007
0

Re: Delphi character count

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
wesley123456789 is offline Offline
3 posts
since May 2007
May 15th, 2007
0

Re: Delphi character count

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.
Reputation Points: 14
Solved Threads: 16
Junior Poster
radu84 is offline Offline
171 posts
since Dec 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Pascal and Delphi Forum Timeline: plz help with game
Next Thread in Pascal and Delphi Forum Timeline: Object or Class Type Required? (Delphi)





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC