Skip to main content
Post Closed as "Duplicate" by Rakete1111 c++
added 101 characters in body
Source Link

could something like this work? I've looked at guides and they don't seem to work for replacing a single char with two or more chars.

 for (int i = 0; i < s.length(); i++){ if(s[i] == '\"') s[i] = '\"\"'; } cout << s; 

could something like this work?

 for (int i = 0; i < s.length(); i++){ if(s[i] == '\"') s[i] = '\"\"'; } cout << s; 

could something like this work? I've looked at guides and they don't seem to work for replacing a single char with two or more chars.

 for (int i = 0; i < s.length(); i++){ if(s[i] == '\"') s[i] = '\"\"'; } cout << s; 
Source Link

(C++) How to search strings and replace each occurrence of a double quote with 2 double quotes?

could something like this work?

 for (int i = 0; i < s.length(); i++){ if(s[i] == '\"') s[i] = '\"\"'; } cout << s;