From 98297beced2af85d416ea857b530fc889bccbbf5 Mon Sep 17 00:00:00 2001 From: tim Date: Thu, 6 Apr 2017 20:22:39 +0100 Subject: recognise euro symbol --- menuApp/src/ofApp.cpp | 43 ++++++++++++++++++++++++++++++++++++++----- notes | 6 +++++- 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/menuApp/src/ofApp.cpp b/menuApp/src/ofApp.cpp index 43ae097..67bc645 100644 --- a/menuApp/src/ofApp.cpp +++ b/menuApp/src/ofApp.cpp @@ -3,7 +3,31 @@ #define timtoken "3281768761.3dfcaf5.14ca9410c2aa4c00b9b60f36cd09d01a" #define hangdaitoken "3939854844.b31608d.a61a4e49a4dc40a688c22f4e0e81da3a" +std::string replaceStrChar(std::string str, const std::string& replace, char ch) { + + // set our locator equal to the first appearance of any character in replace + size_t found = str.find_first_of(replace); + + while (found != std::string::npos) { // While our position in the sting is in range. + str[found] = ch; // Change the character at position. + found = str.find_first_of(replace, found+1); // Relocate again. + } + + return str; // return our new string. +} + void ofApp::loadInstagramFeed(){ + +/* + std::string test[5]; + int testindex=0; + for (int i=0;i<255;i++){ + test[testindex]=" "+test[testindex]; + test[testindex][0]=i; + if (i==25||i==126||i==174||i==229) test[testindex]="\n"+test[testindex]; + if (i==51||i==102||i==153||i==204) testindex++; + } +*/ items.clear(); items.resize(IMAGE_SLOTS); instagram.getUserRecentMedia("self"); @@ -20,7 +44,9 @@ void ofApp::loadInstagramFeed(){ { for ( int i = 0; i < instagram.getImageURL().size(); i++) { - vector tokens = ofSplitString(instagram.getImageCaption()[i]," ",true,true); //,ignoreEmpty=false,trim=false); + std::string str=replaceStrChar(instagram.getImageCaption()[i],"\n",' '); + + vector tokens = ofSplitString(str," ",true,true); //,ignoreEmpty=false,trim=false); std::string caption; std::string price; @@ -43,9 +69,11 @@ void ofApp::loadInstagramFeed(){ tags+=" "; foundTags=true; } - else if((*it).at(0)=='€'){ + else if(((uint8_t)(*it).at(0))==226){ price=*it; foundPrice=true; + price[0]=164; + ofLog(OF_LOG_NOTICE) << "price is "<