Question: Use Swift Code Write own string class. The class will store a private string as its only instance data and implement CustomStringConvertible in a way
Use Swift Code
Write own string class. The class will store a private string as its only instance data and implement CustomStringConvertible in a way that returns the stored string.
Within the class, add support for the following operators (none of these should modify the parameter objects, they should return a new object instead):
+ //concatenates two strings and returns the new one
- //removes any occurrences of the second string from the first
/ //splits the first string on occurrences of the second string (return an array of the split strings)
* //interleaves the two strings
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
