cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
HOW to change value of a number present
HOW to change value of a number present in a string
Oct 30, 2019 at 5:30pm UTC
Beginner of C
(21)
string: this is a 79 pc
output that i want: this is a 200 pc
Oct 30, 2019 at 5:47pm UTC
keskiverto
(10402)
echo "this is a 79 pc" | sed s/79/200/
That, obviously, is not C++ but it gives the requested result.
With C++ string you would first try to
locate
the substring that you want to change:
http://www.cplusplus.com/reference/string/string/find/
and then (if found)
replace
it with new substring:
http://www.cplusplus.com/reference/string/string/replace/
Topic archived. No new replies allowed.