Linked Questions

0 votes
2 answers
2k views

I want to open file , search for string , replace the string and then in the end print from that replaced string until the end. So far I have opened the file using fstream file ("demo.cpp"); Used ...
0circle's user avatar
  • 55
0 votes
4 answers
4k views

well I would like to know how to change number by letter, I would like to replace the number 1 with :x: Here's my code: string stng; printf("Enter with number:"); cin >> stng; replace(stng....
Ph4nton's user avatar
  • 48
1 vote
4 answers
1k views

I need help with the following program. I don't know how to check if occurrences of string2 are inside string1, and then replace them with string3. Write a function named replaceSubstring. The ...
StacksAndParsing's user avatar
1 vote
3 answers
783 views

People who learned how to type before word processors often add two spaces after a period ending a sentence. Write a function singleSpaces that accepts a string and returns that string with all ...
Kc North's user avatar
1 vote
2 answers
2k views

I am wrapping the following C++ code: // content of cpp.h class A { public: virtual int fnA() = 0; virtual ~A() { } }; class B { public: int fnB(A &a) { return a.fnA(); } }; by ...
Klamer Schutte's user avatar
-2 votes
2 answers
2k views

How i can Find and replace (Match Whole word). I have this. void ReplaceString(std::string &subject, const std::string& search, const std::string& replace) { size_t pos = 0; ...
Real Zibux's user avatar
0 votes
3 answers
421 views

I have the code line below std::string inStr = "I go, I walk, I climb"; std::replace( inStr.begin(), inStr.end(), "I", "you");//C2782 With the above code lines, I am getting the compile error error ...
user987316's user avatar
0 votes
3 answers
666 views

Is there a C++ function to escape the control characters in a string? For example, if the input is "First\r\nSecond" the output should be "First\\0x0D\\0x0ASecond".
Hector's user avatar
  • 2,544
1 vote
2 answers
821 views

As the title says, how do I replace a string with another string? For example: the user would enter three inputs. The first input is the string that the program would replace; the second is the string ...
futilecheese28's user avatar
-3 votes
1 answer
1k views

I want a function that takes a string and replaces all occurrences of a given word with asterisks in place of its letters. I want to do this elegantly, like a real C++ programmer. As an example, ...
user3178285's user avatar
0 votes
0 answers
890 views

I am attempting to write a program which will: Open 1.txt (which contains the strings we need to find) Read them into a new string array, seperate elements open 2.txt (which contains the document we ...
James's user avatar
  • 246
2 votes
1 answer
254 views

The problem is I don't know the length of the input string. My function can only replace if the input string is "yyyy". I think of the solution is that first, we will try to convert the input string ...
Tam Nguyen's user avatar
  • 1,205
0 votes
2 answers
341 views

I want to replace substring within a string, For eg: the string is aa0_aa1_bb3_c*a0_a, so I want to replace the substring a0_a with b1_a, but I dont want aa0_a to get replaced. Basically, no ...
Shubham's user avatar
  • 75
0 votes
3 answers
331 views

I have a file, which I want to process and take only some information to modify. I want, on the same run, for the sake of speed, to write the file in another output file. I could just pick the info I ...
gsamaras's user avatar
  • 73.7k
0 votes
1 answer
176 views

The replace function allow to change a character from a string, with another. using: replace(s.begin(), s.end(), 'X', 'Y'); But it is possible to change 2 or more different characters with one? for ...
lidya_q's user avatar

15 30 50 per page