diff --git a/src/include/FlashString/Vector.hpp b/src/include/FlashString/Vector.hpp index ba2dd6a..aa049fa 100644 --- a/src/include/FlashString/Vector.hpp +++ b/src/include/FlashString/Vector.hpp @@ -113,18 +113,30 @@ template class Vector : public Object, con using Object, const ObjectType*>::indexOf; - template - typename std::enable_if::value, int>::type indexOf(const ValueType& value, + template + typename std::enable_if::value, int>::type indexOf(const char* value, bool ignoreCase = true) const { - if(!ignoreCase) { - return Object, const String*>::indexOf(value); + auto dataptr = this->data(); + auto len = this->length(); + auto clen = strlen(value); + for(unsigned i = 0; i < len; ++i) { + if(unsafeValueAt(dataptr, i).equals(value, clen, ignoreCase)) { + return i; + } } + return -1; + } + + template + typename std::enable_if::value, int>::type indexOf(const ValueType& value, + bool ignoreCase = true) const + { auto dataptr = this->data(); auto len = this->length(); for(unsigned i = 0; i < len; ++i) { - if(unsafeValueAt(dataptr, i).equalsIgnoreCase(value)) { + if(unsafeValueAt(dataptr, i).equals(value, ignoreCase)) { return i; } }