+ 1
How to get the output for the below mentioned case?
using c++ regex and boost libraries input for regex : a=b=c ouput required: a b=c
4 Réponses
+ 3
So a+b=b+c*d should become
a+b and b+c*d, right?
For this you need to search for the occurrence of =, and then generate substrings based on that position:
std::string str = "<Your string>;
auto pos = s.find('=');
auto eq_pair = std::make_pair(str substr(0,pos), str.substr(pos));
Now you can access individual strings using the members .first and .second.
+ 3
Hlo everyone,so just to share my piece of work with u and to show a program on this topic im here,and here is the code:
https://code.sololearn.com/cV8g5kUBlsKF/?ref=app
Plz upvote if the code is understandable.
+ 2
Your question is not clear. You have not provided any data about what patterns need to be matched and what replacements need to be made. Secondly, do post your attempts so far, as trying to do this yourself will help you improve. No one should be expected to make a complete code for you. If you face an issue or have a doubt, we are here to help.
Do you want to just replace a single = with a newline or all the occurrences?
If you want to do either of the above, you can simply use the methods in std::string class.
For single replacement:
str.replace(s.find('='),1,"\n");
For multiple replacement:
Iterate over a loop and replace all occurrences using above statement.
while(pos=str.find('=')!=std::string::npos)
{
str.replace(pos,1,"\n");
}
In case this is not what you intended to do, kindly provide a detailed explanation.
+ 1
https://www.sololearn.com/discuss/1699091/?ref=app
input:a=b=c
I need the output with = as delimiter for the first occurance , I need a and b=c separately.. somewhat like key value pairs