━━━━━━━━━━━━━━━━━━ 首部 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;] ━━━━━━━━━━━━━━━━━━━━━ 首部 function NewStr(const S: string): PString; deprecated; $[SysUtils.pas 功能 返回一个新的字符串指针地址 说明 字符串S为空时返回NullStr 参考 procedure System.New 例子 ////////Begin NewStr,DisposeStr procedure TForm1.Button1Click(Sender: TObject); var P: PString; begin P := NewStr(Edit1.Text); Edit2.Text := P^; DisposeStr(P); end; ////////End NewStr,DisposeStr ━━━━━━━━━━━━━━━━━━━━━ 首部 procedure DisposeStr(P: PString); deprecated; $[SysUtils.pas 功能 释放字符串指针P资源 说明 配合函数NewStr使用 参考 procedure System.Dispose 例子 <如上参见,如下参见> ━━━━━━━━━━━━━━━━━━━━━ 首部 procedure AssignStr(var P: PString; const S: string); deprecated; $[SysUtils.pas 功能 将字符串S更新给字符串指针P 说明 更新值时会释放以前字符串指针的资源 参考 function SysUtils.NewStr;function SysUtils.DisposeStr 例子 ////////Begin AssignStr procedure TForm1.Button1Click(Sender: TObject); var P: PString; begin
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >> [系统软件]InstallShield Express for delphi制作安装程序定… [常用软件]InstallShield Express制作Delphi数据库安装程序 [Delphi程序]为什么选择Delphi.Net ? [Delphi程序]《关于VisiBroker For Delphi的使用》(4) [Delphi程序]Delphi 程序员代码编写标准指南 [Delphi程序]转贴:Conversion to Delphi 6: Missing unit Pro… [Delphi程序]Borland Delphi 9 的新特性 [Delphi程序]Delphi 键盘码表 [Delphi程序]Chuck Jazdzewski的离开意味着Delphi的终结吗? [Delphi程序]Delphi Access violations 问题的解决之道
|