正在阅读:Delphi学习:2个不错的通配符比较函数Delphi学习:2个不错的通配符比较函数

2004-09-13 14:41 出处:CSDN 作者:Stanley_Xu 责任编辑:linjixiong


  //Continue testing next char...
  Inc(aSource);
  Inc(aPattern);
  end;

  '[': begin //Match given set of chars.
  if (aPattern[1] in [#0,'[',']']) then
  begin
  //Invalid Set - So no match.
  Result := False;
  Exit;
  end;

  if (aPattern[1] = '^') then
  begin
  //Match for exclusion of given set...
  Inc(aPattern, 2);
  Result := True;
  while (aPattern[0] <> ']') do
  begin
  if (aPattern[1] = '-') then
  begin
  //Match char exclusion range.
  if (aSource[0] >= aPattern[0]) and (aSource[0] <= aPattern[2]) then
  begin
  //Given char failed set exclusion range.
  Result := False;
  Break;
  end else
  Inc(aPattern, 3);
  end else
  begin
  //Match individual char exclusion.
  if (aSource[0] = aPattern[0]) then
  begin
  //Given char failed set element exclusion.
  Result := False;
  Break;
  end else

 


察看评论详细内容 我要发表评论
作者笔名 简短内容 发表时间
:

键盘也能翻页,试试“← →”键

相关文章

关注我们

最新资讯离线随时看 聊天吐槽赢奖品