int wildcmp(const char *wild, const char *string) {
// Written by Jack Handy - jakkhandy@hotmail.com
const char *cp = NULL, *mp = NULL;
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++;
}
return !*wild;
}لو سمحتوا ممكن احد يحولي هذه الدالة من ++C
مغلق
function wildcmp(byVal wild as string , byVal str as string) As integer
{
dim i as integer = 0
do while str.chars(i) <> 0 AndAlso wild.chars(i) <> '*'
IF wild.chars(i) <> str.chars(i) AndAlso wild.chars(i) <> '?' Then
return 0
end if
i = i + 1
loop
dim j as integer = i
dim mp as string
dim mp ms string
do while str.chars(i) <> 0
if wild.chars(i) = '*' then
if wild.chars(++i) = 0 then
return 1
end if
mp = wild.substring(i,wild.length-1)
cp = str.substring(j,str.length-1)
elseif wild.chars(i) = str.chars(j) then
i = i + 1
j = j + 1
else
wild = mp
str = cp.substring (i,wild.length-1)
end if
loop
do while( wild.chars(i) = '*')
i=i+1
loop
return !wild.chars(i)
end functionرغم إني اعرف إن الكود فيه غلطات
الا أني إن شاء الله صلحت اللي علي
:rolleyes: :rolleyes: :rolleyes:
بارك الله فيك ويعطيك الف عافية يكفيني انك حاولت ..
هذا الموضوع مغلق.