|
/***************************************************************************/
/* NOTE: */
/* This document is copyright (c) by Oz Solomonovich, and is bound by the */
/* MIT open source license (www.opensource.org/licenses/mit-license.html). */
/* See License.txt for more information. */
/***************************************************************************/
#include "stdafx.h"
#include "Utils.h"
// keep in mind - this is not an efficient function
void String2StringList(LPCSTR pszString, TCHAR tcSep, CStringList& lst)
{
lst.RemoveAll();
CString cStr;
int i = 0;
while (AfxExtractSubString(cStr, pszString, i, tcSep))
{
if (!cStr.IsEmpty())
{
lst.AddTail(cStr);
}
++i;
}
}
// the following function based on a function by Jack Handy - you may find
// his original article at: http://www.codeproject.com/useritems/wildcmp.asp
int wildcmp(const char *wild, const char *string) {
const char *cp, *mp;
while ((*string) && (*wild != '*')) {
if ((*wild != *string) && (*wild != '?')) {
return 0;
}
wild++;
string++;
}
while (*string) {
if (*wild == '*') {
if (!*++wild) {
return 1;
}
mp = wild;
cp = string+1;
} else if ((*wild == *string) || (*wild == '?')) {
wild++;
string++;
} else {
wild = mp;
string = cp++;
}
}
while (*wild == '*' || *wild == '?') {
wild++;
}
return !*wild;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here