Question: Please in C++ and only C++ Implement the following string methods DynamicString() //Constructs an empty string DynamicString(const char* str) //Constructs a string by copying the

Please in C++ and only C++

Implement the following string methods

DynamicString() //Constructs an empty string

DynamicString(const char* str) //Constructs a string by copying the characters from he char array str

int len() //returns the length of this string

const char* c_str() const // returns a pointer to the underlying char array

char& char_at(int position) //returns the char at the specified position

char char_at(int position) const // returns the char at the specified position

char& operator[](int position) // returns the char at the specified position

char operator[](int position) const // returns the char at the specified position

bool isPrefix(const DynamicString& other) const //True if other is a prefix of this string

bool isIPrefix(const DynamicString& other) const //True if other is a prefix of this string ignoring case(capitalization)

bool isSuffix(const DynamicString& other) const //True if other is a suffix of this string

bool isISuffix(const DynamicString& other) const //True if other is a suffix of this string ignoring case (capitalization)

int compare(const DynamicString& other) const // negative if this is smaller than other, 0 if this is equal to other, positive if this is larger than other

int iCompare(const DynamicString& other) const // same as compare but is case-insensetive

DynamicString& toLower() // converts the string to lowercase

DynamicString& toUpper() // converts the string to uppercase

Helpful C++ library methods:

tolower

toupper

out_of_range

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!