- 1

how to change string into space in c or c++?

example input abc def ghi output abc ghi // i want to change the string from i found a space until i found a space again other example output 222 457 13 9875 5678 input 222 13 5678

10th Nov 2018, 7:27 AM
Yoaraci
Yoaraci - avatar
4 Respuestas
+ 6
With <regex> in C++. std::cout << std::regex_replace("abc def ghi", std::regex("(\\s)([a-zA-Z0-9]*)(\\s)"), " "); std::cout << std::regex_replace("222 457 13 9875 5678", std::regex("(\\s)([a-zA-Z0-9]*)(\\s)"), " ");
10th Nov 2018, 11:29 AM
Hatsy Rei
Hatsy Rei - avatar
+ 4
What did you tried ? And, C++ or C ? (They are different solutions for each)
10th Nov 2018, 9:11 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 3
Can you show me your code ? I'll try to help you :) I am more proficient with C than C++ ^^
10th Nov 2018, 10:38 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
- 1
i more prefer in c actually, but if you more prefer in c++ or only the theory its okay for me😁... i already try using for strlen but the output is only blank
10th Nov 2018, 9:23 AM
Yoaraci
Yoaraci - avatar