Case insensitive std::string.find()

前端 未结 10 1994
挽巷
挽巷 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:36

    Why not just convert both strings to lowercase before you call find()?

    tolower

    Notice:

    • Inefficient for long strings.
    • Beware of internationalization issues.

提交回复
热议问题