How can I replaced characters in string ?like from"almasa"to "alma*a" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I replaced characters in string ?like from"almasa"to "alma*a"

14th May 2020, 11:37 PM
Almasa Sense
Almasa Sense - avatar
8 Answers
+ 1
Pls mention the language name in tags where you Have written fa
14th May 2020, 11:38 PM
Abhay
Abhay - avatar
+ 1
There are several ways, but you can use the string replace function. http://www.cplusplus.com/reference/string/string/replace/
14th May 2020, 11:50 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Thank you very much
15th May 2020, 3:37 PM
Almasa Sense
Almasa Sense - avatar
+ 1
It's work finally thanks👍
15th May 2020, 5:00 PM
Almasa Sense
Almasa Sense - avatar
0
C++
14th May 2020, 11:39 PM
Almasa Sense
Almasa Sense - avatar
0
I have change the last three letters . String a; Cin>>a; e=a.size(); h=e-3; for(int x=0;x>=e;x++) if(a[x]<=h) a[x]; else a[x]="*"; Cout<<a; What I get wrong pls help me
15th May 2020, 12:09 AM
Almasa Sense
Almasa Sense - avatar
0
The question is user inter name and replace the last three letters to * with functions, what can I do to replace ? I used for to inter for each element in array and if to replace to *.
15th May 2020, 4:10 AM
Almasa Sense
Almasa Sense - avatar
0
Thanks
15th May 2020, 4:17 AM
Almasa Sense
Almasa Sense - avatar