Reputation: 1025
I want to need to find a string, replace the string by another string.
For example, replace 'apple' to 'orange' in the following string.
"I love apple"
What function should I use?
Thanks
Upvotes: 0
Views: 1581
Reputation: 27864
Since this question is tagged C++/CLI, I'm assuming you're referring to managed String objects.
If so, then there's a Replace method on the String class you can use.
String^ orig = "I love apple"; String^ modified = orig->Replace("apple", "orange");
Upvotes: 1