diff options
Diffstat (limited to 'src/StringUtil.cc')
-rw-r--r-- | src/StringUtil.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/StringUtil.cc b/src/StringUtil.cc index dabc02e..6d4a582 100644 --- a/src/StringUtil.cc +++ b/src/StringUtil.cc | |||
@@ -35,6 +35,19 @@ char *StringUtil::strdup(const char *s) { | |||
35 | return n; | 35 | return n; |
36 | } | 36 | } |
37 | 37 | ||
38 | //------- strcasestr -------------- | ||
39 | // TODO: comment this | ||
40 | //--------------------------------- | ||
41 | const char * StringUtil::strcasestr(const char *str, const char *ptn) { | ||
42 | const char *s2, *p2; | ||
43 | for( ; *str; str++) { | ||
44 | for(s2=str,p2=ptn; ; s2++,p2++) { | ||
45 | if (!*p2) return str; | ||
46 | if (toupper(*s2) != toupper(*p2)) break; | ||
47 | } | ||
48 | } | ||
49 | return 0; | ||
50 | } | ||
38 | 51 | ||
39 | //------------- expandFilename ---------------------- | 52 | //------------- expandFilename ---------------------- |
40 | // if ~ then expand it to home of user | 53 | // if ~ then expand it to home of user |