upd: first version of booksystem

This commit is contained in:
2023-12-14 03:01:37 +00:00
parent db4830d7d9
commit 7ca2b28548
6 changed files with 230 additions and 9 deletions

View File

@ -346,7 +346,7 @@ bool CommandModifyLexer(const std::string &command, std::string &ISBN,
name = "";
author = "";
keyword = "";
price = 0;
price = -1;
while (ss >> token) {
if (token[1] == 'I') {
ISBN = token.substr(6);
@ -431,7 +431,13 @@ bool CommandShowfinanceLexer(const std::string &command, int &count) {
return false;
}
bool KeyWordSpliter(const std::string &keyword, std::vector<std::string> &words) {
bool KeyWordSpliter(const std::string &keyword, std::vector<std::string> &words,
bool allow_empty) {
words.clear();
if (keyword == "") {
if (!allow_empty) return false;
return true;
}
int current_beg = 0;
for (int i = 0; i < keyword.length(); i++) {
if (keyword[i] == '|') {