strnicmp( ... ) is your tool. the 'n' is for limited length, and the 'i' is for case insensitive. You just need to add the the specific index to the vector: vector+pos
or &vector[pos]
int isKeyFoundAtPos( const char* key, const char* vector, int vPos) {
if( vPos > strlen(vector) ) // if you want to be safe, check for this and deal with it.
return -1;
return 0 == strnicmp( key, vector+vPos, strlen(key) );
}
...
const char* myKey = "abc";
const char* myVector = "123abc456ABC";
isKeyFoundAtPos( myKey, MyVector, 3 ); // string found
isKeyFoundAtPos( myKey, MyVector, 9 ); // string also found
I wrote the wrapper routine as an example, but honestly I would just use strnicmp()
directly.