国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > Delphi > 正文

Delphi6函數(shù)大全(2)

2019-11-17 05:07:47
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

  首部 function RightStr(const AText: string; const ACount: Integer): string; $[StrUtils.pas
功能 返回字符串AText右邊的ACount個(gè)字符
說(shuō)明 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開(kāi)始的ACount個(gè)字符
說(shuō)明 其實(shí)就是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
功能 返回第一個(gè)搜索到的指針位置
說(shuō)明 這函數(shù)常用于文本中搜索字符串
參考 <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
功能 返回探測(cè)字符串
說(shuō)明 根據(jù)探測(cè)法(Soundex)可以找到相進(jìn)的字符串;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
功能 返回探測(cè)整數(shù)
說(shuō)明 ALength的值越大解碼準(zhǔn)確率越高
參考 <NULL>
例子 SpinEdit2.Value := SoundexInt(Edit1.Text, SpinEdit1.Value);
━━━━━━━━━━━━━━━━━━━━━
首部 function DecodeSoundexInt(AValue: Integer): string; $[StrUtils.pas
功能 返回探測(cè)整數(shù)的解碼
說(shuō)明 DecodeSoundexInt(SoundexInt('hello')) 相當(dāng)于 Soundex('hello')
參考 <NULL>
例子 Edit2.Text := DecodeSoundexInt(SpinEdit2.Value);
━━━━━━━━━━━━━━━━━━━━━
首部 function SoundexWord(const AText: string): Word; $[StrUtils.pas
功能 返回探測(cè)文字?jǐn)?shù)值
說(shuō)明 沒(méi)有參數(shù)ALength已經(jīng)固定為4
參考 <NULL>
例子 SpinEdit2.Value := SoundexWord(Edit1.Text);
━━━━━━━━━━━━━━━━━━━━━
首部 function DecodeSoundexWord(AValue: Word): string; $[StrUtils.pas
功能 返回探測(cè)文字?jǐn)?shù)值的解碼
說(shuō)明 DecodeSoundexWord(SoundexWord('hello')) 相當(dāng)于 Soundex('hello')
參考 <NULL>
例子 Edit2.Text := DecodeSoundexWord(SpinEdit2.Value);
━━━━━━━━━━━━━━━━━━━━━
首部 function SoundexSimilar(const AText, AOther: string; ALength: TSoundexLength = 4): Boolean; $[StrUtils.pas
功能 返回兩個(gè)字符串的探測(cè)字符串是否相同
說(shuō)明 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
功能 返回比較兩個(gè)字符串的探測(cè)字符串的結(jié)果
說(shuō)明 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
功能 調(diào)用SoundexSimilar返回兩個(gè)字符串的探測(cè)字符串是否相同
說(shuō)明 系統(tǒng)變量AnsiResemblesProc的默認(rèn)值
參考 function StrUtils.AnsiResemblesText
例子 [var AnsiResemblesProc: TCompareTextProc = SoundexProc;]

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表

圖片精選

主站蜘蛛池模板: 昆山市| 苏尼特左旗| 武胜县| 永丰县| 瓮安县| 黎川县| 连城县| 通海县| 叙永县| 富蕴县| 凉山| 丽水市| 大竹县| 子洲县| 辛集市| 奎屯市| 禄劝| 双牌县| 马鞍山市| 明水县| 和田市| 冷水江市| 军事| 厦门市| 临沂市| 四子王旗| 江永县| 凭祥市| 安新县| 绥江县| 蕲春县| 禹城市| 新邵县| 同仁县| 松原市| 北辰区| 鹰潭市| 南涧| 四子王旗| 和政县| 沁水县|