Replace characters: "Bob" to "John"
I want to replace "Bob" with "John", but if "Bub" is inside the parentheses, it shouldn't be changed.
Input: Bob comes home today, but he (Bob) will not stay long. I will call Bob and tell him (Bob) to come tomorrow.
Output: John comes home today, but he (Bob) will not stay long. I will call John and tell him (Bob) to come tomorrow.
Could it be done by split() to split out all instances of "(Bob)" and save them in an temporary array, then change all instaces of "Bob" to "John". Now we can put back all unchainged "(Bob)" from the array to the string?
Thx for reply,
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread