vector<string> testApp::tokeniseTwitterMessage(ofxTweet tweet){ vector<string> splitUp; splitUp = tokeniseString(tweet.text, " "); //break it up around the spaces return splitUp; }
string testApp::cleanUpDateFromLive(string dateToClean){ //format for live is Tue, 28 Sep 2010 11:42:33 +0000 //cout << "format for live is Tue, 28 Sep 2010 11:42:33 +0000" << ".What I got for LIVE: " << dateToClean << endl; string dateToChange; vector<string> split = tokeniseString(dateToClean, " "); vector<string> splitTime = tokeniseString(split[4], ":"); split[4] = splitTime[0] + ":" + splitTime[1]; dateToChange = split[0] + " " + split[1] + " " + split[2] + " " + split[4]; //TODO: no hardcode! match instead... return dateToChange; }
string testApp::cleanUpDateFromRT(string dateToClean){ //format for RT is: Wed Aug 11 15:49:03 +0000 2010 //cout << "format for RT is: Wed Aug 11 15:49:03 +0000 2010" << ".What I got for RT: " << dateToClean << endl; string dateToChange; vector<string> split = tokeniseString(dateToClean, " "); vector<string> splitTime = tokeniseString(split[3], ":"); split[3] = splitTime[0] + ":" + splitTime[1]; dateToChange = split[0] + ", " + split[2] + " " + split[1] + " " + split[3]; //swapping 2 and 1 to get to the identical format... //TODO: no hardcode! match instead... return dateToChange; }
/** * Skip any whitespace then look for a token, throwing an exception if no valid token * is found. * * Advance the string iterator past the parsed token on success. On failure the string iterator is * in an undefined location. */ const Token& Tokeniser::nextToken() { if ( tokens.size()>tokp ) return tokens[tokp++]; // Don't extend stream of tokens further than the end of stream; if ( tokp>0 && tokens[tokp-1].type==T_EOS ) return tokens[tokp-1]; skipWS(inp, inEnd); tokens.push_back(Token()); Token& tok = tokens[tokp++]; if (tokeniseEos(inp, inEnd, tok)) return tok; if (tokeniseIdentifierOrReservedWord(inp, inEnd, tok)) return tok; if (tokeniseNumeric(inp, inEnd, tok)) return tok; if (tokeniseString(inp, inEnd, tok)) return tok; if (tokeniseParens(inp, inEnd, tok)) return tok; if (tokeniseOperator(inp, inEnd, tok)) return tok; throw TokenException("Found illegal character"); }