lundi 28 octobre 2019

How to delete a string based on spaces

I have a std::string I want to keep the string after two spaces like in Newa and Newb

   String a = "Command send SET  Command comes here";
   String b = "Command GET  Command comes here"; 

   string Newa = "SET  Command comes here";
    string Newb = "Command comes here";

what comes to my mind is that i can do std::string::find(' ') two times and use std::string::substr to get the desired result.

Can we do it in more refined manner.

Aucun commentaire:

Enregistrer un commentaire