I have written a code that is apparently simple: increase the number of "a" in a phrase written by the user but it is not working. Now I'm looking for the example which replaces a section of the current sstringtring in C program.
I have written a code that is apparently simple: increase the number of "a" in a phrase written by the user but it is not working. Now I'm looking for the example which replaces a section of the current sstringtring in C program.
Replaces a section of the current string by some other content determined by the arguments passed. This is a string library that is intended to be compatible with the class string library in the C++ standard. String.Replace Method (Char, Char) Returns a new string in which all occurrences of a specified Unicode character in this instance.
Code:#include <string.h> char d[] = "tabl+cam"; char *q; while ((q = strchr(d,'+')) != NULL) strcpy(q, q+1);
Code:#include <string> #include <iostream> int main() { string d = "This is the string which is to be search"; cout << d << "\n"; int start = d.find("old"); int leng = string("old").size(); d.replace(start, len, "new"); cout << d << "\n"; return 0; }
Bookmarks