| iMatix home page | << | < | > | >> |
SFL Version 2.11 |
#include "sflstr.h" int strtempcmp ( const char *str1, const char *strPat)
Compares a string to a template. Template chars and there functions: # or 9 = Number. A or _ = Alpha. @ = Alphanumeric char = Literal. Char would be the literal to use. ie: "\%" - looks for a % in that postion Returns 0 if == to the template and 1 if != to the template. Submitted by Scott Beasley jscottb@infoave.com
{ int ires = 1; ASSERT (str1); ASSERT (strPat); while (*str1 && *strPat) { switch ((int)*strPat) { case '#': case '9': ires = isdigit ((int)*str1); break; case 'A': case '_': ires = isalpha ((int)*str1); break; case '@': ires = isalnum ((int)*str1); break; case ' ': ires = isspace ((int)*str1); break; case '\\': strPat++; if (*str1 != *strPat) { ires = 1; } break; default: break; } if (!ires) { break; } str1++; strPat++; } return ires ? 0 : 1; }
| << | < | > | >> | Copyright © 1996-2000 iMatix Corporation |