- 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
4 odpowiedzi
+ 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)"), " ");
+ 4
What did you tried ? And, C++ or C ? (They are different solutions for each)
+ 3
Can you show me your code ? I'll try to help you :)
I am more proficient with C than C++ ^^
- 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