codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#include <string> #include <iostream> class Paser { public: Paser ( std::string _Command ); std::string Root ( ); /**std::string Operator ( ); std::string Path1 ( ); std::string Path2 ( ); std::string Variable ( );**/ private: std::string Command; std::string CommandReturn; void CommandSync ( ); }; int main() { Paser Paserd ( "move /a/b/c/d /ca/b/cd/" ); std::cout << Paserd.Root ( ) << '\n'; return 0; } Paser::Paser ( std::string Command ) { Paser::Command = Command; } std::string Paser::Root ( ) { Paser::CommandSync ( ); if ( Command.empty ( ) ) { throw 1; } else if ( Command.find ( " " ) == std::string::npos ) { throw 1; } else { return CommandReturn.substr ( 0 , CommandReturn.find ( " " ) ); } } void Paser::CommandSync ( ) { CommandReturn = Command; }
Private
[
?
]
Run code
Submit