diff options
Diffstat (limited to 'utilities.cpp')
-rw-r--r-- | utilities.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/utilities.cpp b/utilities.cpp index 9c07b89..649b4e1 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -584,3 +584,22 @@ bool isContactHaveKey(HANDLE hContact) return false; } +#define NEWTSTR_MALLOC(A) (A==NULL)?NULL:strcpy((char*)mir_alloc(sizeof(char)*(strlen(A)+1)),A)
+
+const bool StriStr(const char *str, const char *substr)
+{
+ bool i = false;
+ char *str_up = NEWTSTR_MALLOC(str);
+ char *substr_up = NEWTSTR_MALLOC(substr);
+
+ CharUpperBuffA(str_up, strlen(str_up));
+ CharUpperBuffA(substr_up, strlen(substr_up));
+
+ if(strstr (str_up, substr_up))
+ i = true;
+
+ mir_free(str_up);
+ mir_free(substr_up);
+
+ return i;
+}
|