[Solved] How does one get text from inside of parenthesis in c++?


Here is a simple way to do what you are trying to do. (Based on what I can gather from your question)

#include <string>
#include <algorithm>
#include <iostream>

int main(int argc, const char * argv[]) {

    std::string str = "(\"Today is a good day to die.\")";
    std::cout<<str<<std::endl;
    str.erase(std::remove_if(str.begin(),
                             str.end(),
                             [](char x){ return (x == '(' || x==')');}),
              str.end());
    std::cout<<str<<std::endl;
    return 0;
}

See HERE for reference.

EDIT:

Try this within the context of the code your provided

std::string parenthetical(const std::string& s){
    std::string str(s);
    str.erase(std::remove_if(str.begin(),
                             str.end(),
                             [](char x){ return (x == '(' || x==')');}),
              str.end());
    return 0;
}

5

solved How does one get text from inside of parenthesis in c++?