🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.comp.lang.learn.c-c++
Article #136

Re: String Function

#136
From: David Ballentine
Date: Mon, 15 Mar 1999 00:00
30 lines
1752 bytes
Algorithm for countLtr Function:

countLetter = 0

while (we're not at the end of the string)
  if (the character at this position in the array is equal to the search
character)
        increment countLetter by 1
until (we reach the end of the string)

return countLetter

Dave


Chris Psiuk wrote:
> 
> Does anyone know if there is a string function, possibly in String.h,
> that will search through a string and return the number of occurances
> of a certain character.
>     for example in the string "Borland C++"
>     I want the value 2 returned when I want to know how many '+'
>     characters are in the string "Borland C++"

-- 
=============================================================
David R. Ballentine, Assistant Professor, Computer Technology
Westmoreland County Community College, Youngwood PA USA 15697
daveBallentine@att.net                http://www.theGnats.com
ballend@astro.westmoreland.cc.pa.us     Phone: 1-724-925-4253
Technical Details
Message-ID: <36ED8144.3C79FBC4@worldnet.att.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36ebe918.0@news.cgocable.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109fba,f33d01c31aba151a
X-Google-Attributes: gid109fba,public
X-Google-Thread: 10d4ba,f33d01c31aba151a
X-Google-Attributes: gid10d4ba,public
X-Google-Thread: 114592,f33d01c31aba151a
X-Google-Attributes: gid114592,public
From: David Ballentine <DaveBallentine@worldnet.att.net>
Subject: Re: String Function
Date: 1999/03/15
Message-ID: <36ED8144.3C79FBC4@worldnet.att.net>
X-Deja-AN: 455375505
Content-Transfer-Encoding: 7bit
References: <36ebe918.0@news.cgocable.net>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: AT&T WorldNet Services
Mime-Version: 1.0
Reply-To: DaveBallentine@worldnet.att.net
Newsgroups: alt.comp.lang.learn.c-c++,att.lang.c++,comp.lang.c++