hello i am able to get index of "@" in c++ but not in qt. i dont know what i have to use to find("@",found+1,q)
Qt Code:
  1. #include <iostream> // std::cout
  2. #include <string> // std::string
  3.  
  4. int main ()
  5. {
  6. std::string str ("msel@-txt/l<seq_name>@#ifndef I_MSEL_@-txt/u<seq_name>@_H");
  7. std::string tag ("@");
  8.  
  9.  
  10.  
  11. // different member versions of find in the same order as above:
  12. std::size_t found = str.find(tag);
  13. if (found!=std::string::npos)
  14. std::cout << "first '@' found at: " << found << '\n';
  15.  
  16. for (int i = 0; i <= 5; i++)
  17. { int q =1;
  18. found=str.find("@",found+1,q);
  19. q++;
  20. if (found!=std::string::npos)
  21. std::cout << " '@' found at: " << found << '\n';
  22. }
  23.  
  24. return 0;
  25. }
To copy to clipboard, switch view to plain text mode