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

◆ isSuffixOf()

bool WordWithDataTable::isSuffixOf ( WordWithData word1,
WordWithData word2 )
staticprivate

Definition at line 358 of file WordTable.cpp.

360{
361 auto word1size = word1.size();
362 auto word2size = word2.size();
363 if (word2size < word1size) return false;
364 // at this point if word2.size() == 0, then word2 (and hence word1) are both empty
365 if (word2size == 0) return false;
366 bool match = true;
367 for (auto k = 0; k < word1size; ++k)
368 if (word1.begin()[word1size-1-k] != word2.begin()[word2size-1-k])
369 {
370 match = false;
371 break;
372 }
373 return match;
374}
size_t size() const
Definition Word.hpp:148
const int * begin() const
Definition Word.hpp:140

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

Referenced by isSuffix().