30 lines
626 B
C++
30 lines
626 B
C++
#pragma once
|
|
|
|
#include "String.h"
|
|
#include "Array.h"
|
|
|
|
class Text : public Array<String> {
|
|
public:
|
|
void Print() const {
|
|
printf("text length=%ld\n", this->getLength());
|
|
|
|
auto elems = this->getElements();
|
|
for (size_t i = 0; i < elems.size(); ++i) {
|
|
printf("i=%ld; [%s]\n", i, elems[i]->getCharArray());
|
|
// elements[i]->println();
|
|
}
|
|
}
|
|
|
|
bool hasMatch(const String& s) const {
|
|
|
|
for (auto& elem : this->getElements()) {
|
|
if (s.contains(*elem)) {
|
|
//printf("match: [%s]\n", elements[i]->getCharArray());
|
|
return true;
|
|
}
|
|
}
|
|
//printf("no matches for [%s]\n", s.getCharArray());
|
|
return false;
|
|
}
|
|
};
|