[ create a new paste ] login | about

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

C++, pasted on May 17:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#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 << substring;
return 1;
}


Output:
1
11-Mar-198401


Create a new paste based on this one


Comments: