Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
std::string s("121 151 225 456");
std::stringstream ss(s);
T val;
do { ss >> val; cout << val << endl; } while( ss.good() ); 

 

String methods

Code Block
#include <string> 

std::string basename(const std::string& path)
{
  size_t pos = path.find_last_of('/');
  //if (pos == std::string::npos) return std::string();
  if (pos < path.size()-1) return std::string(path,pos+1);
  else return std::string();
}

 

Check if directory exists

...