source: flair-src/trunk/lib/FlairCore/src/FindArgument.cpp @ 157

Last change on this file since 157 was 157, checked in by Sanahuja Guillaume, 5 years ago

iadded isready to iodevice:
avoid problem of imu not ready in ardrone2

File size: 517 bytes
Line 
1#include "FindArgument.h"
2
3std::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.