diff options
Diffstat (limited to 'utilities.cpp')
-rw-r--r-- | utilities.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/utilities.cpp b/utilities.cpp index 4d3b3cf..bf61929 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -144,12 +144,12 @@ tstring variables_parse(tstring const &tstrFormat, HANDLE hContact){ return tstrFormat; } -// case-insensitive _tcsstr +// case-insensitive _tcscmp //by nullbie as i remember... #define NEWTSTR_MALLOC(A) (A==NULL)?NULL:_tcscpy((TCHAR*)mir_alloc(sizeof(TCHAR)*(_tcslen(A)+1)),A) const int Stricmp(const TCHAR *str, const TCHAR *substr) { - int i; + int i = 0; TCHAR *str_up = NEWTSTR_MALLOC(str); TCHAR *substr_up = NEWTSTR_MALLOC(substr); @@ -164,3 +164,20 @@ const int Stricmp(const TCHAR *str, const TCHAR *substr) return i; } +const int Stristr(const TCHAR *str, const TCHAR *substr) +{ + int i = 0; + TCHAR *str_up = NEWTSTR_MALLOC(str); + TCHAR *substr_up = NEWTSTR_MALLOC(substr); + + CharUpperBuff(str_up, lstrlen(str_up)); + CharUpperBuff(substr_up, lstrlen(substr_up)); + + if(_tcsstr (str_up, substr_up)) + i = 1; + + mir_free(str_up); + mir_free(substr_up); + + return i; +} |