Question: and then display just the initials. For example, if the input is John Peter Doe, the initials JPDmust be displayed. Member functions of the stringclass
and then display just the initials. For example, if the input is John Peter Doe, the initials JPDmust
be displayed.
Member functions of the stringclass to manipulate the values of stringobjects are provided on the
next page.
QUESTION MARKS
COS
OctNov
TURN OVER
Function signature Description
int size Returns the size ie length of a string object.
string substrintint Returns a substring of a string object. The first parameter
specifies the starting position ie the position from which
the substring should be copied and the second parameter
specifies how long the substring should be ie how many
characters should be copied The second parameter may be
omitted, in which case the substring consisting of all the
characters from the starting position specified by the first
and only parameter to the end of the string are returned.
int findstringint Returns the position of a string specified as the first
parameter within a string object. The second parameter is
optional, and can be used to specify where the search has to
be commenced. If omitted, the search commences at the
beginning of the string object. If the string being sought is not
found, is returned.
void insertintstring Inserts a string specified as the second parameter into a
string object at a particular position specified as the first
parameter
void eraseintint Erases a substring from a string object. The substring that is
to be erased is determined by the two parameters: from the
position specified by the first parameter, as many characters
as specified by the second parameter
void replaceintint,string Replaces specified characters of a string object with another
string. The characters to be replaced are determined by the
first two parameters: from the position specified by the first
parameter, as many characters as specified by the second
parameter. The string to be inserted in their place is specified
by the third parameter.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
