String Manipulation Practice
replace
9
1
2
// replaces n characters starting from start with str2
str.replace(start, n, str2)
12// replaces n characters starting from start with str2 str.replace(start, n, str2)
Tehtävä
Swipe to start coding
- Replace the
"debug"
with"release"
. - Your program should output
mode=release
.
Ratkaisu
solution
99
1
2
3
4
5
6
7
8
9
10
#include <iostream>
int main()
{
std::string config = "mode=debug"; // Do not change this line
config.replace(5, 5, "release"); // Replace "debug" with "release"
std::cout << config; // Do not change this line
}
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 3. Luku 5
99
1
2
3
4
5
6
7
8
9
10
#include <iostream>
int main()
{
std::string config = "mode=debug"; // Do not change this line
config.replace(___, ___, ___); // Replace "debug" with "release"
std::cout << config; // Do not change this line
}
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme