首部 function rightstr(const atext: string; const acount: integer): string; $[strutils.pas
功能 返回字符串atext右边的acount个字符
说明 rightstr('123456', 3) = '456'
参考 function system.copy
例子 edit3.text := rightstr(edit1.text, spinedit1.value);
━━━━━━━━━━━━━━━━━━━━━
首部 function midstr(const atext: string; const astart, acount: integer): string; $[strutils.pas
功能 返回字符串atext从astart开始的acount个字符
说明 其实就是copy
参考 function system.copy
例子 edit3.text := midstr(edit1.text, spinedit1.value, spinedit2.value);
━━━━━━━━━━━━━━━━━━━━━
首部 function searchbuf(buf: pchar; buflen: integer; selstart, sellength: integer; searchstring: string; options: tstringsearchoptions = [sodown]): pchar; $[strutils.pas
功能 返回第一个搜索到的指针位置
说明 这函数常用于文本中搜索字符串
参考 <null>
例子
///////begin searchbuf
function searchedit(editcontrol: tcustomedit; const searchstring: string;
searchoptions: tstringsearchoptions; findfirst: boolean = false): boolean;
var
buffer, p: pchar;
size: word;
begin
result := false;
if (length(searchstring) = 0) then exit;
size := editcontrol.gettextlen;
if (size = 0) then exit;
buffer := stralloc(size + 1);
try
editcontrol.gettextbuf(buffer, size + 1);
p := searchbuf(buffer, size, editcontrol.selstart, editcontrol.sellength,
searchstring, searchoptions);
if p <> nil then begin
editcontrol.selstart := p - buffer;
editcontrol.sellength := length(searchstring);
result := true;
end;
finally
strdispose(buffer);
end;
end;
procedure tform1.button1click(sender: tobject);
var
searchoptions: tstringsearchoptions;
begin
searchoptions := [];
if checkbox1.checked then
include(searchoptions, sodown);
if checkbox2.checked then
include(searchoptions, somatchcase);
if checkbox3.checked then
include(searchoptions, sowholeword);
searchedit(memo1, edit1.text, searchoptions);
memo1.setfocus;
end;
///////end searchbuf
━━━━━━━━━━━━━━━━━━━━━
首部 function soundex(const atext: string; alength: tsoundexlength = 4): string; $[strutils.pas
功能 返回探测字符串
说明 根据探测法(soundex)可以找到相进的字符串;http://www.nara.gov/genealogy/coding.html
参考 <null>
例子 edit2.text := soundex(edit1.text, spinedit1.value);
━━━━━━━━━━━━━━━━━━━━━
首部 function soundexint(const atext: string; alength: tsoundexintlength = 4): integer; $[strutils.pas
功能 返回探测整数
说明 alength的值越大解码准确率越高
参考 <null>
例子 spinedit2.value := soundexint(edit1.text, spinedit1.value);
━━━━━━━━━━━━━━━━━━━━━
首部 function decodesoundexint(avalue: integer): string; $[strutils.pas
功能 返回探测整数的解码
说明 decodesoundexint(soundexint('hello')) 相当于 soundex('hello')
参考 <null>
例子 edit2.text := decodesoundexint(spinedit2.value);
━━━━━━━━━━━━━━━━━━━━━
首部 function soundexword(const atext: string): word; $[strutils.pas
功能 返回探测文字数值
说明 没有参数alength已经固定为4
参考 <null>
例子 spinedit2.value := soundexword(edit1.text);
━━━━━━━━━━━━━━━━━━━━━
首部 function decodesoundexword(avalue: word): string; $[strutils.pas
功能 返回探测文字数值的解码
说明 decodesoundexword(soundexword('hello')) 相当于 soundex('hello')
参考 <null>
例子 edit2.text := decodesoundexword(spinedit2.value);
━━━━━━━━━━━━━━━━━━━━━
首部 function soundexsimilar(const atext, aother: string; alength: tsoundexlength = 4): boolean; $[strutils.pas
功能 返回两个字符串的探测字符串是否相同
说明 result := soundex(atext, alength) = soundex(aother, alength)
参考 <null>
例子 checkbox1.checked := soundexsimilar(edit1.text, edit2.text, spinedit1.value);
━━━━━━━━━━━━━━━━━━━━━
首部 function soundexcompare(const atext, aother: string; alength: tsoundexlength = 4): integer; $[strutils.pas
功能 返回比较两个字符串的探测字符串的结果
说明 result := ansicomparestr(soundex(atext, alength), soundex(aother, alength))
参考 function sysutils.ansicomparestr
例子 spinedit2.value := soundexcompare(edit1.text, edit2.text, spinedit1.value);
━━━━━━━━━━━━━━━━━━━━━
首部 function soundexproc(const atext, aother: string): boolean; $[strutils.pas
功能 调用soundexsimilar返回两个字符串的探测字符串是否相同
说明 系统变量ansiresemblesproc的默认值
参考 function strutils.ansiresemblestext
例子 [var ansiresemblesproc: tcomparetextproc = soundexproc;]
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器