@@ -113,18 +113,30 @@ template <class ObjectType> class Vector : public Object<Vector<ObjectType>, con
113
113
114
114
using Object<Vector<ObjectType>, const ObjectType*>::indexOf;
115
115
116
- template <typename ValueType, typename T = ObjectType>
117
- typename std::enable_if<std::is_same<T, String>::value, int >::type indexOf (const ValueType& value,
116
+ template <typename T = ObjectType>
117
+ typename std::enable_if<std::is_same<T, String>::value, int >::type indexOf (const char * value,
118
118
bool ignoreCase = true ) const
119
119
{
120
- if (!ignoreCase) {
121
- return Object<Vector<String>, const String*>::indexOf (value);
120
+ auto dataptr = this ->data ();
121
+ auto len = this ->length ();
122
+ auto clen = strlen (value);
123
+ for (unsigned i = 0 ; i < len; ++i) {
124
+ if (unsafeValueAt (dataptr, i).equals (value, clen, ignoreCase)) {
125
+ return i;
126
+ }
122
127
}
123
128
129
+ return -1 ;
130
+ }
131
+
132
+ template <typename ValueType, typename T = ObjectType>
133
+ typename std::enable_if<std::is_same<T, String>::value, int >::type indexOf (const ValueType& value,
134
+ bool ignoreCase = true ) const
135
+ {
124
136
auto dataptr = this ->data ();
125
137
auto len = this ->length ();
126
138
for (unsigned i = 0 ; i < len; ++i) {
127
- if (unsafeValueAt (dataptr, i).equalsIgnoreCase (value)) {
139
+ if (unsafeValueAt (dataptr, i).equals (value, ignoreCase )) {
128
140
return i;
129
141
}
130
142
}
0 commit comments