-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckWord.h
59 lines (44 loc) · 1.13 KB
/
checkWord.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//
// Created by Barlas on 1/11/2021.
//
#ifndef REQUENT_WORDS_CHECKWORD_H
#define REQUENT_WORDS_CHECKWORD_H
bool whenStart = false;
std::string START_WORD = "<BODY>";
std::string END_WORD = "</BODY>";
bool isStart(std::string word){
if(word.find(START_WORD) != std::string::npos) {
return true;
}
return false;
}
bool isEnd(std::string word){
if(word.find(END_WORD) != std::string::npos) {
return true;
}
return false;
}
std::string checkWord(std::string test){
std::string tempWord;
if(isEnd(test)){
whenStart = false;
}
if(whenStart && ((test[0] >= 'a' && test[0]<= 'z')||(test[0] >= 'A' && test[0]<= 'Z'))){
char* next_token1;
char* token = strtok_s(&test[0], "\",.]:'>()", &next_token1);
return token;
}
if(isStart(test)){
whenStart = true;
int startPos = test.find(START_WORD) + START_WORD.length();
for (int i = startPos; i < test.size(); ++i) {
tempWord += test[i];
}
test = tempWord;
return test;
}
else{
return "";
}
}
#endif //REQUENT_WORDS_CHECKWORD_H