codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#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; }
Private
[
?
]
Run code
Submit