string - substr() method in C++ -


i trying substring expressions individual tokens such !, &, | (), etc. having trouble fact when try make sub-string of "!(s&b|h)&!(s&j|r)&!(p)" cout line below, get: "(s&j|r)&!(p)", when thought should be: "(s&j|r)". either beyond have seen or simple not getting it. lot. thanks.

#include <iostream> #include <string>  using namespace std;  int main(int argc, const char * argv[]) {  string name = "!(s&b|h)&!(s&j|r)&!(p)";  cout<<name.substr(10,16)<<endl;   return 0;  }//main 

i did not understand question if want get

(s&j|r) 

you should do:

name.substr(10,7)

the second parameter length.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -