Comparing strings

I try to compare strings with find(), but it doesn't seem to work.
ref is a big string, searchVector is a vector of type string. What I wanna do is, traverse the vector and look if there's a hit on an instance. If there are I want to store the place where the hit was, in myHits[].
1
2
3
4
5
6
7
8
               if(ref.find(searchVector.at(i))){
                       myHits[i] = ref.find(searchVector.at(i));
                       printf("Hit");
               } else if (ref.find(reverseString(searchVector.at(i)))){
                       myHits[i] = ref.find(reverseString(searchVector.at(i)));
               } else {
                       myHits[i] = 0;
               }


What am I doing wrong here..?
find returns std::string::npos if the string was not found.
if (str.find(str2) != std::string::npos)
Hmm... But I can't seem to get it returning the position of the hit to myHits..?
1
2
3
4
5
6
7
8
9
10
11
12
       for (i = myStart; i <= myEnd; i++) {
               if(ref.find(searchVector.at(i)) != std::string::npos){
                     printf("FRONT: My hits: %d, ID: %d \n",myHits[i], tid);
                     myHits[i] = ref.find(searchVector.at(i));
               } else if (ref.find(reverseString(searchVector.at(i))) != std::string::npos ){
                       myHits[i] = ref.find(reverseString(searchVector.at(i)));
                      printf("BACKWARDS: My hits: %d, ID: %d \n",myHits[i], tid);
               } else {
                       myHits[i] = 0;
                       printf("MISS: My hits: %d, ID: %d \n",myHits[i], tid);
               }
       } 
Topic archived. No new replies allowed.