How to remove double quotes from first and last positions of a string in C++

1 Answer

0 votes
#include <iostream>

int main() {
    std::string s = "\"c++ \"node.js\" c c++ c# python\"";
    std::cout << s << '\n';
    
    s.erase( 0, 1 ); 
    s.erase( s.size() - 1 ); 

    std::cout << s;
}



/*
run:

"c++ "node.js" c c++ c# python"
c++ "node.js" c c++ c# python

*/

 



answered Feb 20, 2022 by avibootz

Related questions

2 answers 225 views
1 answer 126 views
1 answer 92 views
1 answer 132 views
1 answer 138 views
1 answer 128 views
...