Case insensitive std::string.find()

前端 未结 10 2007
挽巷
挽巷 2020-11-27 02:47

I am using std::string\'s find() method to test if a string is a substring of another. Now I need case insensitive version of the same thing. For s

10条回答
  •  广开言路
    2020-11-27 03:34

    wxWidgets has a very rich string API wxString

    it can be done with (using the case conversion way)

    int Contains(const wxString& SpecProgramName, const wxString& str)
    {
      wxString SpecProgramName_ = SpecProgramName.Upper();
      wxString str_ = str.Upper();
      int found = SpecProgramName.Find(str_);
      if (wxNOT_FOUND == found)
      {
        return 0;
      }
      return 1;
    }
    

提交回复
热议问题