对于字符串的模糊查找,在Delphi中如何进行啊?像数据库中的%,*等通配符在Delphi中有吗?是什么呀?

解决方案 »

  1.   

    你可以用pos函数
    判断一个字符串是否 在另一字符串里
      

  2.   

    if pos(substr,str) >=0 then
      

  3.   

    首部 function AnsiResemblesText(const AText, AOther: string): Boolean; $[StrUtils.pas
    功能 返回两个字符串是否相似
    说明 ANSI(American National Standards Institute)美国国家标准协会;不区分大小写
    参考 function StrUtils.SoundexProc; var StrUtils.AnsiResemblesProc
    例子 CheckBox1.Checked := AnsiResemblesText(Edit1.Text, Edit2.Text);
      

  4.   

    'select * from ... where 字段名 like '''+变量+'''';
      

  5.   

    write code by your self, refer to Lisp language (artificial intelligence)
      

  6.   

    select * from ... where 字段名 like '%关键字%'
    可以使用不同的通配符
      

  7.   

    利用GotoNearest和FindNearest执行不精确查找