0

I am in my last two exercises and need some assistance starting these as I have no idea what I am doing with these...

1. Write a function replace_all(), such that a call

newString = replace_all(str, substring, newSubstring);

will return a copy of string str with each occurrence of substring replaced by newSubstring.

2. A string is said to be a palindrome if it does not change when the order of its characters is reversed. Write a function that, given a string, returns true if that string is a palindrome and returns false otherwise


Any help in getting started would be greatly appreciated.

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by vmanes
0

For the first one, look at the various find() string functions, for starters.

For the second, that's been well discussed, a little search should help you find any of the several possible solutions. Best solutions do not require creating another string, but those can be the easiest.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.