Take the 2-minute tour ×  i want to replace a character in the
string with a string. can i do it in-place? As the new string
has length greater than original string.Question is that can i
do with using additional buffer? for example  void
replaceChar(std::string &input, std::string replacementString,
char charToReplace) //some code here. No additional buffer  void
main(){    std::string input = "I am posting a comment on
LinkedIn";   std::string replacementString = "pppp";   char
charToReplace = 'o';   replaceChar(input, replacementString,
charToReplace);  I only want the strategy (algorithm). it would
be good if algorithm will be designed keeping some language in
mind that will not dynamically increase or decrease the string
length once it was initilized like c++  share|improve this
question Where do you expect the extra characters will go? – 
AShelly Apr 5 '12 at 14:37 Ya thats what actually i am asking
that because i have seen a code implementation in java that
calculated the new length of the string and s