2个不错的通配符比较函数[3]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 fsxlh 的 blog

                 begin
                   //match individual char exclusion.
                   if (asource[0] = apattern[0]) then
                   begin
                     //given char failed set element exclusion.
                     result := false;
                     break;
                   end else
                    inc(apattern);
                 end;
               end;
             end else
             begin
               //match for inclusion of given set...
               inc(apattern);
               result := false;
               while (apattern[0] <> ']') do
               begin
                 if (apattern[1] = '-') then
                 begin
                   //match char inclusion range.
                   if (asource[0] >= apattern[0]) and (asource[0] <= apattern[2]) then
                   begin
                     //given char matched set range inclusion.
                     // continue testing...
                     result := true;
                     break;
                   end else
                    inc(apattern, 3);
                 end else
                 begin
                   //match individual char inclusion.
                   if (asource[0] = apattern[0]) then
                   begin
                     //given char matched set element inclusion.
                     // continue testing...
                     result := true;
                     break;
                   end else
                     inc(apattern);
                 end;
               end;
             end;

             if (result) then
             begin
               //match was found. continue further.
               inc(asource);
               //position pattern to char after "]"
               while (apattern[0] <> ']') and (apattern[0] <> #0) do inc(apattern);
               if (apattern[0] = #0) then
               begin
                 //invalid pattern - missing "]"
                 result := false;
                 exit;
               end else
                 inc(apattern);
             end else
               exit;

本文关键:2个不错的通配符比较函数
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top