Add Searching in UniStore v2!

This commit is contained in:
StackZ
2020-06-19 12:56:12 +02:00
parent 62e16be262
commit e03cf47b67
4 changed files with 56 additions and 3 deletions
+16
View File
@@ -82,6 +82,22 @@ UniStoreV2Struct Store::getData(const int index) {
return temp;
}
int Store::searchForEntries(const std::string searchResult) {
std::vector<UniStoreV2Struct> temp;
for (int i = 0; i < (int)this->sortedStore.size(); i++) {
if (this->sortedStore[i].title.find(searchResult) != std::string::npos) {
temp.push_back({this->sortedStore[i]});
}
}
if (temp.size() != 0) {
this->sortedStore = temp;
}
return (int)temp.size();
}
// Title.
bool compareTitleDescending(const UniStoreV2Struct& a, const UniStoreV2Struct& b) {
int result = a.title.compare(b.title);