c 2b 2b get string between two characters

Solutions on MaxInterview for c 2b 2b get string between two characters by the best coders in the world

showing results for - "c 2b 2b get string between two characters"
Lina
26 Nov 2016
1string str = "STARTDELIMITER_0_192.168.1.18_STOPDELIMITER";
2unsigned first = str.find(STARTDELIMITER);
3unsigned last = str.find_last_of(STOPDELIMITER);
4string strNew = str.substr (first,last-first);
5std::cout << strNew << std::endl;