c*******9 发帖数: 6411 | 1 what is the best way to compare string ignore case? I did not find an
method in the string class doing that, do I still need to use c to convert
the character to all lowercase or uppercase? |
d****p 发帖数: 685 | 2 I remember I posted the same question before.
The fastest (not necessarily the best) way is to set up a look up table T
such that T[uppercase(char)] = T[lowercase(char)]. |
a****o 发帖数: 686 | 3 tolower(char c)
C++ and C both have a version of tolower, do not mix them.
most likely, you will need a template to wrap it if you have to include
stdio.h in C++. |
t****u 发帖数: 8614 | 4 stricmp()
【在 c*******9 的大作中提到】 : what is the best way to compare string ignore case? I did not find an : method in the string class doing that, do I still need to use c to convert : the character to all lowercase or uppercase?
|
N***m 发帖数: 4460 | 5 then use string's c_str() function first
【在 t****u 的大作中提到】 : stricmp()
|