Data Structures & Algorithms in C++
Goodrich, Tamassia, Mount and Goldwasser
Loading...
Searching...
No Matches
Functions
dsac::primer Namespace Reference

Code from the chapter "A C++ Primer". More...

Functions

int count (std::string s, char target)
 Returns the number of occurrences of target character in string s.
 
int count (const char *s, int n, char target)
 Returns the number of occurrences of target character in the n-character array s.
 
void remove_all (std::string &s, char target)
 Removes all occurrences of target character from string s.
 

Detailed Description

Code from the chapter "A C++ Primer".

Function Documentation

◆ count() [1/2]

int dsac::primer::count ( const char *  s,
int  n,
char  target 
)

Returns the number of occurrences of target character in the n-character array s.

◆ count() [2/2]

int dsac::primer::count ( string  s,
char  target 
)

Returns the number of occurrences of target character in string s.

◆ remove_all()

void dsac::primer::remove_all ( string &  s,
char  target 
)

Removes all occurrences of target character from string s.