source:
flair-src/trunk/lib/FlairCore/src/FindArgument.cpp
Last change on this file was 157, checked in by , 8 years ago | |
---|---|
File size: 517 bytes |
Line | |
---|---|
1 | #include "FindArgument.h" |
2 | |
3 | std::string FindArgument(std::string args,std::string arg,bool recquired) { |
4 | size_t position=args.find (arg); |
5 | |
6 | if(position!=std::string::npos) { |
7 | size_t endPosition=args.find(" ",position); |
8 | size_t len; |
9 | if(endPosition!=std::string::npos) { |
10 | len=endPosition-position-arg.size(); |
11 | } else { |
12 | len=std::string::npos; |
13 | } |
14 | return args.substr(position+arg.size(),len); |
15 | } else { |
16 | if(recquired) printf("no %s statement in arguments (%s)\n",arg.c_str(),args.c_str()); |
17 | return ""; |
18 | } |
19 | } |
Note:
See TracBrowser
for help on using the repository browser.