[ create a new paste ] login | about

Link: http://codepad.org/FZdQi9ti    [ raw code | output | fork ]

C++, pasted on May 17:
#include <iostream>
int main()

{ 
  std::string s ="11-Mar-1984 01";

  char seperator = ' ';
    std::string::size_type prev_pos = 0, pos = 0;

    while((pos = s.find(seperator, pos)) != std::string::npos)
    {
        std::string substring( s.substr(prev_pos, pos-prev_pos) );

        cout << substring;
        prev_pos = ++pos;
    }
     std::string substring(s.substr(prev_pos, pos-prev_pos));
   int time = boost::lexical_cast<int>(substring);

cout << time;
return 1;
}


Output:
1
11-Mar-19841


Create a new paste based on this one


Comments: