I know how to replace all occurrences of a character with another character in string ([How to replace all occurrences of a character in string?](https://stackoverflow.com/questions/2896600/how-to-replace-all-occurrences-of-a-character-in-string))

But what if I want to replace all even numbers in string with given string? I am confused between `replace`, `replace_if` and member `replace`/`find` functions of `basic_string` class, because signature of functions require old\_val and new\_val to be same type. But old\_val is char, and new\_val is string. Is there any effective way to do this, not using multiple loops?

e.g. if the input string is

> 
> "asjkdn3vhsjdvcn2asjnbd2vd"
> 
> 
> 

and the replacement text is

> 
> "whatever"
> 
> 
> 

, the result should be

> 
> "asjkdn3vhsjdvcnwhateverasjnbdwhatevervd"
> 
> 
>