Macaulay2 Engine
Loading...
Searching...
No Matches

◆ isSuffixOf()

bool WordTable::isSuffixOf ( Word word1,
Word word2 )
staticprivate

Definition at line 100 of file WordTable.cpp.

102{
103 auto word1size = word1.size();
104 auto word2size = word2.size();
105 if (word2size < word1size) return false;
106 // at this point if word2.size() == 0, then word2 (and hence word1) are both empty
107 if (word2size == 0) return false;
108 bool match = true;
109 for (auto k = 0; k < word1size; ++k)
110 if (word1.begin()[word1size-1-k] != word2.begin()[word2size-1-k])
111 {
112 match = false;
113 break;
114 }
115 return match;
116}
const int * begin() const
Definition Word.hpp:72
int size() const
Definition Word.hpp:74

References Word::begin(), and Word::size().

Referenced by isSuffix().