replace %20 in title by space

pull/23/head
JuanJakobo 2020-10-05 21:01:56 +02:00
parent 8c281df1de
commit 2e19fc4021
5 changed files with 18 additions and 3 deletions

View File

@ -64,8 +64,10 @@ ListView::~ListView()
delete _font; delete _font;
} }
void ListView::drawHeader(const string &headerText) void ListView::drawHeader(string headerText)
{ {
headerText = Util::replaceString(headerText,"%20"," ");
_font = OpenFont("LiberationMono", 35, 1); _font = OpenFont("LiberationMono", 35, 1);
SetFont(_font, BLACK); SetFont(_font, BLACK);

View File

@ -39,7 +39,7 @@ public:
* draws the header including an item to navigate a page up * draws the header including an item to navigate a page up
* *
*/ */
void drawHeader(const string &headerText); void drawHeader(string headerText);
/** /**
* draws the footer including a page changer * draws the footer including a page changer

View File

@ -49,6 +49,7 @@ Item::Item(const string &xmlItem)
} }
_title = _title.substr(_title.find_last_of("/") + 1, _title.length()); _title = _title.substr(_title.find_last_of("/") + 1, _title.length());
_title = Util::replaceString(_title,"%20"," ");
} }
void Item::open() const void Item::open() const

View File

@ -82,3 +82,13 @@ string Util::getXMLAttribute(const string &buffer, const string &name)
return NULL; return NULL;
} }
string Util::replaceString(string item, const string& find, const string& to)
{
for (size_t pos = item.find(find); pos != string::npos; pos = item.find(find, pos))
{
item.replace(pos, find.length(), to);
}
return item;
}

View File

@ -57,6 +57,8 @@ public:
*/ */
static string getXMLAttribute(const string &buffer, const string &name); static string getXMLAttribute(const string &buffer, const string &name);
static string replaceString(string item,const string& find,const string& to);
private: private:
Util() {} Util() {}
}; };