轉載:Delphi字符串函數大全

uses StrUtils; 【字符串函數大全】 首部 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); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiContainsText(const AText, ASubText: string): Boolean; $[StrUtils.pas 功能 返回字符串AText是否包含子串ASubText 說明 不區分大小寫 參考 function StrUtils.AnsiUppercase; function StrUtils.AnsiPos 例子 CheckBox1.Checked := AnsiContainsText(Edit1.Text, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiStartsText(const ASubText, AText: string): Boolean; $[StrUtils.pas 功能 返回字符串AText是否以子串ASubText開頭 說明 不區分大小寫 參考 function Windows.CompareString 例子 CheckBox1.Checked := AnsiStartsText(Edit1.Text, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiEndsText(const ASubText, AText: string): Boolean; $[StrUtils.pas 功能 返回字符串AText是否以子串ASubText結尾 說明 不區分大小寫 參考 function Windows.CompareString 例子 CheckBox1.Checked := AnsiEndsText(Edit1.Text, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiReplaceText(const AText, AFromText, AToText: string): string; $[StrUtils.pas 功能 返回字符串AText中用子串AFromText替換成子串AToText的結果 說明 不區分大小寫 參考 function SysUtils.StringReplace; type SysUtils.TReplaceFlags 例子 Edit4.Text := AnsiReplaceText(Edit1.Text, Edit2.Text, Edit3.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiMatchText(const AText: string; const AValues: array of string): Boolean; $[StrUtils.pas 功能 返回字符串數組AValues中是否包含字符串AText 說明 不區分大小寫 參考 function StrUtils.AnsiIndexText 例子 CheckBox1.Checked := AnsiMatchText(Edit1.Text, ['a1', 'a2', 'a3', 'a4']); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiIndexText(const AText: string; const AValues: array of string): Integer; $[StrUtils.pas 功能 返回字符串AText在字符串數組AValues中的位置 說明 不區分大小寫;如果不包含則返回-1 參考 function SysUtils.AnsiSameText 例子 SpinEdit1.Value := AnsiIndexText(Edit1.Text, ['a1', 'a2', 'a3', 'a4']); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiContainsStr(const AText, ASubText: string): Boolean; $[StrUtils.pas 功能 返回字符串AText是否包含子串ASubText 說明 區分大小寫 參考 function StrUtils.AnsiPos 例子 CheckBox1.Checked := AnsiContainsStr(Edit1.Text, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiStartsStr(const ASubText, AText: string): Boolean; $[StrUtils.pas 功能 返回字符串AText是否以子串ASubText開頭 說明 區分大小寫 參考 function SysUtils.AnsiSameStr 例子 CheckBox1.Checked := AnsiStartsStr(Edit1.Text, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiEndsStr(const ASubText, AText: string): Boolean; $[StrUtils.pas 功能 返回字符串AText是否以子串ASubText結尾 說明 區分大小寫 參考 function SysUtils.AnsiSameStr 例子 CheckBox1.Checked := AnsiEndsStr(Edit1.Text, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiReplaceStr(const AText, AFromText, AToText: string): string; $[StrUtils.pas 功能 返回字符串AText中用子串AFromText替換成子串AToText的結果 說明 區分大小寫 參考 function SysUtils.StringReplace; type SysUtils.TReplaceFlags 例子 Edit4.Text := AnsiReplaceStr(Edit1.Text, Edit2.Text, Edit3.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiMatchStr(const AText: string; const AValues: array of string): Boolean; $[StrUtils.pas 功能 返回字符串數組AValues中是否包含字符串AText 說明 區分大小寫 參考 function StrUtils.AnsiIndexStr 例子 CheckBox1.Checked := AnsiMatchStr(Edit1.Text, ['a1', 'a2', 'a3', 'a4']); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiIndexStr(const AText: string; const AValues: array of string): Integer; $[StrUtils.pas 功能 返回字符串AText在字符串數組AValues中的位置 說明 區分大小寫 參考 function SysUtils.AnsiSameStr 例子 SpinEdit1.Value := AnsiIndexStr(Edit1.Text, ['a1', 'a2', 'a3', 'a4']); ━━━━━━━━━━━━━━━━━━━━━ 首部 function DupeString(const AText: string; ACount: Integer): string; $[StrUtils.pas 功能 返回字符串AText的ACount個複本 說明 當ACount爲0時返回'' 參考 function System.SetLength 例子 Edit3.Text := DupeString(Edit1.Text, SpinEdit1.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function ReverseString(const AText: string): string; $[StrUtils.pas 功能 返回字符串AText的反序 說明 ReverseString('1234') = '4321' 參考 function System.SetLength 例子 Edit3.Text := ReverseString(Edit1.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StuffString(const AText: string; AStart, ALength: Cardinal; const ASubText: string): string; $[StrUtils.pas 功能 返回嵌套字符串 說明 AStart:嵌套開始位置;ALength:嵌套長度;StuffString('abcd', 2, 0, '12') = 'a12bcd' 參考 function System.Copy 例子 Edit3.Text := StuffString(Edit1.Text, SpinEdit1.Value, SpinEdit2.Value, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function RandomFrom(const AValues: array of string): string; overload; $[StrUtils.pas 功能 隨機返回字符串數組AValues中的一個元素 說明 之前建議執行Randomize 參考 function System.Random 例子 Randomize; Edit3.Text := RandomFrom(['a1', 'a2', 'a3', 'a4']); ━━━━━━━━━━━━━━━━━━━━━ 首部 function IfThen(AValue: Boolean; const ATrue: string; AFalse: string = ''): string; overload; $[StrUtils.pas 功能 返回指定的邏輯字符串 說明 IfThen(True, '是', '否') = '是';IfThen(False, '是', '否') = '否' 參考 例子 Edit3.Text := IfThen(CheckBox1.Checked, Edit1.Text, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function LeftStr(const AText: string; const ACount: Integer): string; $[StrUtils.pas 功能 返回字符串AText左邊的ACount個字符 說明 LeftStr('123456', 3) = '123' 參考 function System.Copy 例子 Edit3.Text := LeftStr(Edit1.Text, SpinEdit1.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 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 功能 返回第一個搜索到的指針位置 說明 這函數常用於文本中搜索字符串 參考 例子 ///////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 參考 例子 Edit2.Text := Soundex(Edit1.Text, SpinEdit1.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function SoundexInt(const AText: string; ALength: TSoundexIntLength = 4): Integer; $[StrUtils.pas 功能 返回探測整數 說明 ALength的值越大解碼準確率越高 參考 例子 SpinEdit2.Value := SoundexInt(Edit1.Text, SpinEdit1.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function DecodeSoundexInt(AValue: Integer): string; $[StrUtils.pas 功能 返回探測整數的解碼 說明 DecodeSoundexInt(SoundexInt('hello')) 相當於 Soundex('hello') 參考 例子 Edit2.Text := DecodeSoundexInt(SpinEdit2.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function SoundexWord(const AText: string): Word; $[StrUtils.pas 功能 返回探測文字數值 說明 沒有參數ALength已經固定爲4 參考 例子 SpinEdit2.Value := SoundexWord(Edit1.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function DecodeSoundexWord(AValue: Word): string; $[StrUtils.pas 功能 返回探測文字數值的解碼 說明 DecodeSoundexWord(SoundexWord('hello')) 相當於 Soundex('hello') 參考 例子 Edit2.Text := DecodeSoundexWord(SpinEdit2.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function SoundexSimilar(const AText, AOther: string; ALength: TSoundexLength = 4): Boolean; $[StrUtils.pas 功能 返回兩個字符串的探測字符串是否相同 說明 Result := Soundex(AText, ALength) = Soundex(AOther, ALength) 參考 例子 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 P := nil; AssignStr(P, Edit1.Text); Edit2.Text := P^; DisposeStr(P); end; ////////End AssignStr ━━━━━━━━━━━━━━━━━━━━━ 首部 procedure AppendStr(var Dest: string; const S: string); deprecated; $[SysUtils.pas 功能 在字符串Dest後追加字符串S 說明 相當於Dest := Dest + S;Delphi6已經不建議使用 參考 例子 ////////Begin AppendStr procedure TForm1.Button1Click(Sender: TObject); var S: string; begin S := Edit2.Text; AppendStr(S, Edit1.Text); Edit2.Text := S; end; ////////End AppendStr ━━━━━━━━━━━━━━━━━━━━━ 首部 function UpperCase(const S: string): string; $[SysUtils.pas 功能 返回字符串S的大寫形式 說明 非小寫字符不處理 參考 procedure System.SetLength 例子 Edit2.Text := UpperCase(Edit1.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function LowerCase(const S: string): string; $[SysUtils.pas 功能 返回字符串S的小寫形式 說明 非大寫字符不處理 參考 procedure System.SetLength 例子 Edit2.Text := LowerCase(Edit1.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function CompareStr(const S1, S2: string): Integer; $[SysUtils.pas 功能 返回比較兩個字符 說明 當S1>S2返回值>0;當S1 例子 SpinEdit1.Value := CompareStr(Edit1.Text, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function CompareMem(P1, P2: Pointer; Length: Integer): Boolean; assembler; $[SysUtils.pas 功能 返回比較兩個內存指針 說明 CompareMem(PChar('12a'), PChar('12c'), 2)=True;CompareMem(PChar('12a'), PChar('12c'), 3)=False 參考 例子 CheckBox1.Checked := CompareMem(Self, Form1, 8); ━━━━━━━━━━━━━━━━━━━━━ 首部 function CompareText(const S1, S2: string): Integer; $[SysUtils.pas 功能 返回比較兩個字符串 說明 不區分大小寫 參考 例子 SpinEdit1.Value := CompareText(Edit1.Text, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function SameText(const S1, S2: string): Boolean; $[SysUtils.pas 功能 返回兩個字符串是否相等 說明 不區分大小寫 參考 例子 CheckBox1.Checked := SameText(Edit1.Text, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiUpperCase(const S: string): string; $[SysUtils.pas 功能 返回字符串S的大寫形式 說明 ANSI(American National Standards Institute)美國國家標準協會;非小寫的字符不變 參考 function Windows.CharUpperBuff 例子 Edit2.Text := AnsiUpperCase(Edit1.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiLowerCase(const S: string): string; $[SysUtils.pas 功能 返回字符串S的小寫形式 說明 非大寫字符不處理 參考 function Windows.CharLowerBuff 例子 Edit2.Text := AnsiLowerCase(Edit1.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiCompareStr(const S1, S2: string): Integer; $[SysUtils.pas 功能 反回比較兩個字符串 說明 當S1>S2返回值>0;當S1S2返回值>0;當S1S2返回值>0;當S1S2返回值>0;當S1S2返回值>0;當S1S2返回值>0;當S1S2返回值>0;當S1S2返回值>0;當S1 ━━━━━━━━━━━━━━━━━━━━━ 首部 function IsValidIdent(const Ident: string): Boolean; $[SysUtils.pas 功能 返回字符串Ident是否是正確的標識符 說明 標識符::字母|下劃線[字母|下劃線|數字]... 參考 例子 CheckBox1.Checked := IsValidIdent(Edit1.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function IntToStr(Value: Integer): string; overload; $[SysUtils.pas 首部 function IntToStr(Value: Int64): string; overload; $[SysUtils.pas 功能 返回整數Value轉換成字符串 說明 Format('%d', [Value]) 參考 function SysUtils.FmtStr 例子 Edit2.Text := IntToStr(SpinEdit1.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function IntToHex(Value: Integer; Digits: Integer): string; overload; $[SysUtils.pas 首部 function IntToHex(Value: Int64; Digits: Integer): string; overload; $[SysUtils.pas 功能 返回整數Value轉換成十六進制表現結果;Format('%.*x', [Digits, Value]) 說明 參數Digits指定字符最小寬度;最小寬度不足時將用0填充 參考 function SysUtils.FmtStr 例子 Edit2.Text := IntToHex(SpinEdit1.Value, SpinEdit2.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToInt(const S: string): Integer; $[SysUtils.pas 功能 返回字符串S轉換成整數 說明 字符串非整數表達時將引起異常 參考 procedure System.Val 例子 SpinEdit1.Value := StrToInt(Edit1.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToIntDef(const S: string; Default: Integer): Integer; $[SysUtils.pas 功能 返回字符串S轉換成整數 說明 字符串非整數表達時則返回默認值Default 參考 procedure System.Val 例子 SpinEdit1.Value := StrToIntDef(Edit1.Text, 0); ━━━━━━━━━━━━━━━━━━━━━ 首部 function TryStrToInt(const S: string; out Value: Integer): Boolean; $[SysUtils.pas 功能 返回字符串S轉換成整數Value是否成功 說明 字符串非整數表達時返回False並且Value將輸出爲0 參考 procedure System.Val 例子 ///////Begin TryStrToInt procedure TForm1.Button1Click(Sender: TObject); var I: Integer; begin CheckBox1.Checked := TryStrToInt(Edit1.Text, I); SpinEdit1.Value := I; end; ///////End TryStrToInt ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToInt64(const S: string): Int64; $[SysUtils.pas 功能 返回字符串S轉換成六十四位整數 說明 字符串非六十四位整數表達時將引起異常 參考 procedure System.Val 例子 SpinEdit1.Value := StrToInt64(Edit1.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToInt64Def(const S: string; const Default: Int64): Int64; $[SysUtils.pas 功能 返回字符串S轉換成六十四位整數 說明 字符串非六十四位整數表達時則返回默認值Default 參考 procedure System.Val 例子 SpinEdit1.Value := StrToInt64Def(Edit1.Text, 0); ━━━━━━━━━━━━━━━━━━━━━ 首部 function TryStrToInt64(const S: string; out Value: Int64): Boolean; $[SysUtils.pas 功能 返回字符串S轉換成六十四位整數Value是否成功 說明 字符串非六十四位整數表達時返回False並且Value將輸出爲0 參考 procedure System.Val 例子 ///////Begin TryStrToInt64 procedure TForm1.Button1Click(Sender: TObject); var I: Int64; begin CheckBox1.Checked := TryStrToInt64(Edit1.Text, I); SpinEdit1.Value := I; end; ///////End TryStrToInt64 ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToBool(const S: string): Boolean; $[SysUtils.pas 功能 返回字符串S轉換成邏輯值 說明 字符非邏輯表達時將引起異常 參考 function SysUtils.TryStrToBool 例子 CheckBox1.Checked := StrToBool(Edit1.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToBoolDef(const S: string; const Default: Boolean): Boolean; $[SysUtils.pas 功能 返回字符串S轉換成邏輯值 說明 字符非邏輯表達時則返回默認值Default 參考 function SysUtils.TryStrToBool 例子 CheckBox1.Checked := StrToBoolDef(Edit1.Text, False); ━━━━━━━━━━━━━━━━━━━━━ 首部 function TryStrToBool(const S: string; out Value: Boolean): Boolean; $[SysUtils.pas 功能 返回字符串S轉換成邏輯值Value是否成功 說明 [注意]0爲假非0爲真;不是'True'和'False';Delphi6 Bug 如下修正 參考 function SysUtils.AnsiSameText;var SysUtils.TrueBoolStrs;var SysUtils.FalseBoolStrs 例子 ///////Begin TryStrToBool procedure TForm1.Button1Click(Sender: TObject); var B: Boolean; begin SetLength(TrueBoolStrs, 2); SetLength(FalseBoolStrs, 2); TrueBoolStrs[0] := 'True'; FalseBoolStrs[0] := 'False'; TrueBoolStrs[1] := 'Yes'; FalseBoolStrs[1] := 'No'; CheckBox1.Checked := TryStrToBool(Edit1.Text, B); CheckBox2.Checked := B; end; ///////End TryStrToBool 附加 ///////Begin TryStrToBool function TryStrToBool(const S: string; out Value: Boolean): Boolean; function CompareWith(const aArray: array of string): Boolean; var I: Integer; begin Result := False; for I := Low(aArray) to High(aArray) do if AnsiSameText(S, aArray[I]) then begin Result := True; Break; end; end; var LResult: Extended; begin Result := TryStrToFloat(S, LResult); if Result then Value := LResult <> 0 else begin Result := True; //修正處 VerifyBoolStrArray; if CompareWith(TrueBoolStrs) then Value := True else if CompareWith(FalseBoolStrs) then Value := False else Result := False; end; end; ///////End TryStrToBool ━━━━━━━━━━━━━━━━━━━━━ 首部 function BoolToStr(B: Boolean; UseBoolStrs: Boolean = False): string; $[SysUtils.pas 功能 返回邏輯值B轉換成字符串 說明 BoolToStr(False, False)='0';BoolToStr(False, True)='-1' 參考 var SysUtils.TrueBoolStrs;var SysUtils.FalseBoolStrs 例子 Edit1.Text := BoolToStr(CheckBox1.Checked, CheckBox2.Checked); ━━━━━━━━━━━━━━━━━━━━━ 首部 function LoadStr(Ident: Integer): string; $[SysUtils.pas 功能 返回根據標識Ident的字符串資源 說明 字符串資源是指程序的內部資源 參考 function SysUtils.FindStringResource 例子 Edit2.Text := LoadStr(StrToIntDef(Edit1.Text, 0)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function FmtLoadStr(Ident: Integer; const Args: array of const): string; $[SysUtils.pas 功能 返回格式化的字符串資源 說明 字符串資源是指程序的內部資源 參考 function SysUtils.FmtStr;function SysUtils.FindStringResource 例子 ; ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrLen(const Str: PChar): Cardinal; $[SysUtils.pas 功能 返回指針字符串的長度 說明 當指針字符串Str爲nil時將觸發異常 參考 例子 SpinEdit2.Value := StrLen(PChar(Edit1.Text)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrEnd(const Str: PChar): PChar; $[SysUtils.pas 功能 返回指針字符串的結尾 說明 當指針字符串Str爲nil時將觸發異常 參考 例子 Edit2.Text := StrEnd(PChar(Edit1.Text)) - SpinEdit1.Value; ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrMove(Dest: PChar; const Source: PChar; Count: Cardinal): PChar; $[SysUtils.pas 功能 返回將指針字符串Source指定內存數量Count複製覆蓋到指針字符串Dest中 說明 Dest沒有分配資源將觸發異常s 參考 function System.Move 例子 ///////Begin StrMove procedure TForm1.Button1Click(Sender: TObject); var vBuffer: PChar; begin vBuffer := '0123456789'; StrMove(vBuffer, PChar(Edit1.Text), SpinEdit1.Value); Edit2.Text := vBuffer; end; ///////End StrMove ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrCopy(Dest: PChar; const Source: PChar): PChar; $[SysUtils.pas 功能 返回將指針字符串Source複製到指針字符串Dest中 說明 Dest應已經分配足夠的空間非則將觸發異常 參考 例子 ///////Begin StrCopy procedure TForm1.Button1Click(Sender: TObject); var vBuffer: PChar; begin GetMem(vBuffer, Length(Edit1.Text) + 1); StrCopy(vBuffer, PChar(Edit1.Text)); Edit2.Text := vBuffer; FreeMem(vBuffer); end; ///////End StrCopy ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrECopy(Dest:PChar; const Source: PChar): PChar; $[SysUtils.pas 功能 返回將指針字符串Source複製到指針字符串Dest中的結尾 說明 可以連接指針字符串 參考 例子 ///////Begin StrECopy procedure TForm1.Button1Click(Sender: TObject); var vBuffer: array[0..255] of Char; begin StrECopy(StrECopy(vBuffer, PChar(Edit1.Text)), PChar(Edit2.Text)); Edit3.Text := vBuffer; end; ///////End StrECopy ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrLCopy(Dest: PChar; const Source: PChar; MaxLen: Cardinal): PChar; $[SysUtils.pas 功能 返回將指針字符串Source指定長度MaxLen複製到指針字符串Dest中 說明 Dest應已經分配足夠的空間非則將觸發異常 參考 例子 ///////Begin StrLCopy procedure TForm1.Button1Click(Sender: TObject); var vBuffer: array[0..255] of Char; begin StrLCopy(vBuffer, PChar(Edit1.Text), SpinEdit1.Value); Edit2.Text := vBuffer; end; ///////End StrLCopy ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrPCopy(Dest: PChar; const Source: string): PChar; $[SysUtils.pas 功能 返回將指針字符串Source複製到指針字符串Dest中 說明 StrLCopy(Dest, PChar(Source), Length(Source)) 參考 function SysUtils.StrLCopy 例子 ///////Begin StrPCopy procedure TForm1.Button1Click(Sender: TObject); var vBuffer: array[0..255] of Char; begin StrPCopy(vBuffer, PChar(Edit1.Text)); Edit2.Text := vBuffer; end; ///////End StrPCopy ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrPLCopy(Dest: PChar; const Source: string; MaxLen: Cardinal): PChar; $[SysUtils.pas 功能 返回將字符串Source指定長度MaxLen複製到指針字符串Dest中 說明 StrLCopy(Dest, PChar(Source), MaxLen) 參考 function SysUtils.StrLCopy 例子 ///////Begin StrPLCopy procedure TForm1.Button1Click(Sender: TObject); var vBuffer: array[0..255] of Char; begin StrPLCopy(vBuffer, Edit1.Text, SpinEdit1.Value); Edit2.Text := vBuffer; end; ///////End StrPLCopy ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrCat(Dest: PChar; const Source: PChar): PChar; $[SysUtils.pas 功能 返回連接指針字符串Dest和指針字符串Source 說明 StrCopy(StrEnd(Dest), Source) 參考 function SysUntils.StrCopy 例子 ///////Begin StrCat procedure TForm1.Button1Click(Sender: TObject); var vBuffer: array[0..255] of Char; begin StrPCopy(vBuffer, Edit1.Text); StrCat(vBuffer, PChar(Edit2.Text)); Edit3.Text := vBuffer; end; ///////End StrCat ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrLCat(Dest: PChar; const Source: PChar; MaxLen: Cardinal): PChar; $[SysUtils.pas 功能 返回連接指針字符串Dest和指針字符串Source 說明 [注意]MaxLen指定連接後的最大長度不是指針字符串Source的長度 參考 例子 ///////Begin StrLCat procedure TForm1.Button1Click(Sender: TObject); var vBuffer: array[0..255] of Char; begin StrPCopy(vBuffer, Edit1.Text); StrLCat(vBuffer, PChar(Edit2.Text), SpinEdit1.Value); Edit3.Text := vBuffer; end; ///////End StrLCat ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrComp(const Str1, Str2: PChar): Integer; $[SysUtils.pas 功能 返回比較兩個指針字符串 說明 當S1>S2返回值>0;當S1 例子 SpinEdit1.Value := StrComp(PChar(Edit1.Text), PChar(Edit2.Text)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrIComp(const Str1, Str2: PChar): Integer; $[SysUtils.pas 功能 返回比較兩個指針字符串 說明 當S1>S2返回值>0;當S1 例子 SpinEdit1.Value := StrIComp(PChar(Edit1.Text), PChar(Edit2.Text)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrLComp(const Str1, Str2: PChar; MaxLen: Cardinal): Integer; $[SysUtils.pas 功能 返回比較兩個指針字符串指定長度 說明 當S1>S2返回值>0;當S1 例子 SpinEdit1.Value := StrLComp(PChar(Edit1.Text), PChar(Edit2.Text), SpinEdit2.Value) ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrLIComp(const Str1, Str2: PChar; MaxLen: Cardinal): Integer; $[SysUtils.pas 功能 返回比較兩個指針字符串指定長度 說明 當S1>S2返回值>0;當S1 例子 SpinEdit1.Value := StrLIComp(PChar(Edit1.Text), PChar(Edit2.Text), SpinEdit2.Value) ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrScan(const Str: PChar; Chr: Char): PChar; $[SysUtils.pas 功能 返回在指針字符串Str搜索字符Chr第一個出現的地址 說明 沒有找到則返回空指針 參考 例子 Edit2.Text := StrScan(PChar(Edit1.Text), '*'); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrRScan(const Str: PChar; Chr: Char): PChar; $[SysUtils.pas 功能 返回在指針字符串Str搜索字符Chr最後一個出現的地址 說明 沒有找到則返回空指針 參考 例子 Edit2.Text := StrRScan(PChar(Edit1.Text), '*'); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrPos(const Str1, Str2: PChar): PChar; $[SysUtils.pas 功能 返回指針字符串Str2在Str1中第一個出現的地址 說明 沒有找到則返回空指針;StrPos('12345', '3') = '345' 參考 例子 Edit3.Text := StrPos(PChar(Edit1.Text), PChar(Edit2.Text)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrUpper(Str: PChar): PChar; $[SysUtils.pas 功能 返回指針字符串Str大寫 說明 非小寫字符不處理 參考 例子 Edit1.Text := StrUpper(PChar(Edit2.Text)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrLower(Str: PChar): PChar; $[SysUtils.pas 功能 返回指針字符串Str小寫 說明 非大寫字符不處理 參考 例子 Edit1.Text := StrLower(PChar(Edit2.Text)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrPas(const Str: PChar): string; $[SysUtils.pas 功能 返回指針字符串Str轉換成字符串 說明 也可以直接賦值 參考 例子 Edit1.Text := StrPas(PChar(Edit2.Text)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrAlloc(Size: Cardinal): PChar; $[SysUtils.pas 功能 返回分配指定空間的內存資源給指針字符串 說明 空間的大小也將保存;用StrDispose才能全部釋放 參考 function System.GetMem 例子 ///////Begin StrAlloc procedure TForm1.Button1Click(Sender: TObject); var P: PChar; begin P := StrAlloc(SpinEdit1.Value); ShowMessage(IntToStr(StrLen(P))); Dec(P, SizeOf(Cardinal)); ShowMessage(IntToStr(Cardinal(Pointer(P)^))); Inc(P, SizeOf(Cardinal)); StrDispose(P); end; ///////End StrAlloc ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrBufSize(const Str: PChar): Cardinal; $[SysUtils.pas 功能 返回通過函數StrAlloc分配的緩衝區大小 說明 出現異常情況則返回不可預知的結果 參考 function System.SizeOf 例子 SpinEdit1.Value := StrBufSize(StrAlloc(SpinEdit2.Value)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrNew(const Str: PChar): PChar; $[SysUtils.pas 功能 返回複製一個新的指針字符串 說明 如果Str爲nil則返回nil 參考 function SysUtils.StrLen;function SysUtils.StrMove;function SysUtils.StrAlloc 例子 ///////Begin StrNew,StrDispose procedure TForm1.Button1Click(Sender: TObject); var P: PChar; begin P := StrNew(PChar(Edit1.Text)); ShowMessage(P); StrDispose(P); end; ///////End StrNew,StrDispose ━━━━━━━━━━━━━━━━━━━━━ 首部 procedure StrDispose(Str: PChar); $[SysUtils.pas 功能 釋放指針字符串Str內存資源 說明 如果Str爲nil則不作任何處理;並且釋放空間大小信息 參考 function System.Dec;function System.SizeOf;function System.FreeMem 例子 <參見StrNew> ━━━━━━━━━━━━━━━━━━━━━ 首部 function Format(const Format: string; const Args: array of const): string; $[SysUtils.pas 功能 返回按指定方式格式化一個數組常量的字符形式 說明 這個函數是我在Delphi中用得最多的函數,現在就列舉幾個例子給你個直觀的理解 "%" [索引 ":"] ["-"] [寬度] ["." 摘要] 類型 Format('x=%d', [12]); //'x=12' //最普通 Format('x=%3d', [12]); //'x= 12' //指定寬度 Format('x=%f', [12.0]); //'x=12.00' //浮點數 Format('x=%.3f', [12.0]); //'x=12.000' //指定小數 Format('x=%.*f', [5, 12.0]); //'x=12.00000' //動態配置 Format('x=%.5d', [12]); //'x=00012' //前面補充0 Format('x=%.5x', [12]); //'x=0000C' //十六進制 Format('x=%1:d%0:d', [12, 13]); //'x=1312' //使用索引 Format('x=%p', [nil]); //'x=00000000' //指針 Format('x=%1.1e', [12.0]); //'x=1.2E+001' //科學記數法 Format('x=%%', []); //'x=%' //得到"%" S := Format('%s%d', [S, I]); //S := S + StrToInt(I); //連接字符串 參考 proceduer SysUtils.FmtStr 例子 Edit1.Text := Format(Edit2.Text, [StrToFloatDef(Edit.3.Text, 0)]); ━━━━━━━━━━━━━━━━━━━━━ 首部 procedure FmtStr(var Result: string; const Format: string; const Args: array of const); $[SysUtils.pas 功能 按指定方式格式化一個數組常量的字符形式返回 說明 <參見Format> 參考 function SysUtils.FormatBuf;function System.Length;function System.SetLength 例子 <參見Format> ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrFmt(Buffer, Format: PChar; const Args: array of const): PChar; $[SysUtils.pas 功能 返回按指定方式格式化一個數組常量的字符指針形式 說明 如果Buffer和Format其中只要有一個爲nil則返回nil 參考 function SysUtils.FormatBuf 例子 <參見Format> ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrLFmt(Buffer: PChar; MaxBufLen: Cardinal; Format: PChar; const Args: array of const): PChar; $[SysUtils.pas 功能 返回按指定方式和長度格式化一個數組常量的字符指針形式 說明 StrLFmt(vBuffer, 6, '%d|12345', [1024]) = '1024|1'; 參考 function SysUtils.FormatBuf 例子 <參見Format> ━━━━━━━━━━━━━━━━━━━━━ 首部 function FormatBuf(var Buffer; BufLen: Cardinal; const Format; FmtLen: Cardinal; const Args: array of const): Cardinal; $[SysUtils.pas 功能 返回按指定方式格式化一個數組常量到緩衝區Buffer中 說明 參考 例子 <參見Format> ━━━━━━━━━━━━━━━━━━━━━ 首部 function WideFormat(const Format: WideString; const Args: array of const): WideString; $[SysUtils.pas 功能 返回按指定方式格式化一個數組常量的多字節字符形式 說明 參考 procedure SysUtils.WideFmtStr 例子 <參見Format> ━━━━━━━━━━━━━━━━━━━━━ 首部 procedure WideFmtStr(var Result: WideString; const Format: WideString; const Args: array of const); $[SysUtils.pas 功能 按指定方式格式化一個數組常量的多字節字符形式返回 說明 參考 function SysUtils.WideFormatBuf 例子 <參見Format> ━━━━━━━━━━━━━━━━━━━━━ 首部 function WideFormatBuf(var Buffer; BufLen: Cardinal; const Format; FmtLen: Cardinal; const Args: array of const): Cardinal; $[SysUtils.pas 功能 返回按指定方式格式化一個數組常量到緩衝區Buffer中 說明 參考 例子 <參見Format> ━━━━━━━━━━━━━━━━━━━━━ 首部 function FloatToStr(Value: Extended): string; $[SysUtils.pas 功能 返回浮點數Value轉換成字符串 說明 當浮點數大等於1E15將採用科學記數法 參考 function SysUtils.FloatToText 例子 Edit1.Text := FloatToStr(Now); ━━━━━━━━━━━━━━━━━━━━━ 首部 function CurrToStr(Value: Currency): string; $[SysUtils.pas 功能 返回貨幣數Value轉換成字符串 說明 貨幣數只保留四位小數 參考 function SysUtils.FloatToText 例子 Edit1.Text := CurrToStr(Now); ━━━━━━━━━━━━━━━━━━━━━ 首部 function FloatToCurr(const Value: Extended): Currency; $[SysUtils.pas 功能 返回浮點數Value轉換成貨幣數 說明 如果浮點數Value超出範圍則將觸發異常 參考 const SysUtiles.MinCurrency;const SysUtiles.MaxCurrency 例子 Edit1.Text := CurrToStr(FloatToCurr(Now)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function FloatToStrF(Value: Extended; Format: TFloatFormat; Precision, Digits: Integer): string; $[SysUtils.pas 功能 返回浮點數以指定格式轉換成字符串 說明 Precision指定精度;Digits指定小數寬度 參考 function SysUtils.FloatToText 例子 ///////Begin FloatToStrF procedure TForm1.Button1Click(Sender: TObject); begin Memo1.Lines.Values['ffGeneral'] := FloatToStrF(StrToFloatDef(Edit1.Text, 0), ffGeneral, SpinEdit1.Value, SpinEdit2.Value); Memo1.Lines.Values['ffExponent'] := FloatToStrF(StrToFloatDef(Edit1.Text, 0), ffExponent, SpinEdit1.Value, SpinEdit2.Value); Memo1.Lines.Values['ffFixed'] := FloatToStrF(StrToFloatDef(Edit1.Text, 0), ffFixed, SpinEdit1.Value, SpinEdit2.Value); Memo1.Lines.Values['ffNumber'] := FloatToStrF(StrToFloatDef(Edit1.Text, 0), ffNumber, SpinEdit1.Value, SpinEdit2.Value); Memo1.Lines.Values['ffCurrency'] := FloatToStrF(StrToFloatDef(Edit1.Text, 0), ffCurrency, SpinEdit1.Value, SpinEdit2.Value); end; ///////End FloatToStrF ━━━━━━━━━━━━━━━━━━━━━ 首部 function CurrToStrF(Value: Currency; Format: TFloatFormat; Digits: Integer): string; $[SysUtils.pas 功能 返回貨幣類型以指定格式轉換成字符串 說明 Digits指定小數寬度 參考 function SysUtils.FloatToText 例子 ///////Begin CurrToStrF procedure TForm1.Button1Click(Sender: TObject); begin Memo1.Lines.Values['ffGeneral'] := CurrToStrF(StrToCurrDef(Edit1.Text, 0), ffGeneral, SpinEdit1.Value); Memo1.Lines.Values['ffExponent'] := CurrToStrF(StrToCurrDef(Edit1.Text, 0), ffExponent, SpinEdit1.Value); Memo1.Lines.Values['ffFixed'] := CurrToStrF(StrToCurrDef(Edit1.Text, 0), ffFixed, SpinEdit1.Value); Memo1.Lines.Values['ffNumber'] := CurrToStrF(StrToCurrDef(Edit1.Text, 0), ffNumber, SpinEdit1.Value); Memo1.Lines.Values['ffCurrency'] := CurrToStrF(StrToCurrDef(Edit1.Text, 0), ffCurrency, SpinEdit1.Value); end; ///////End CurrToStrF ━━━━━━━━━━━━━━━━━━━━━ 首部 function FloatToText(BufferArg: PChar; const Value; ValueType: TFloatValue; Format: TFloatFormat; Precision, Digits: Integer): Integer; $[SysUtils.pas 功能 返回浮點數以指定格式轉換成指針字符串的內存大小 說明 Precision指定精度;Digits指定小數寬度 參考 例子 ///////Begin FloatToText procedure TForm1.Button1Click(Sender: TObject); var vBuffer: array[0..255] of Char; E: Extended; begin E := StrToFloatDef(Edit1.Text, 0); SpinEdit3.Value := FloatToText(vBuffer, E, fvExtended, ffNumber, SpinEdit1.Value, SpinEdit2.Value); Edit2.Text := Copy(vBuffer, 1, SpinEdit3.Value); end; ///////End FloatToText( ━━━━━━━━━━━━━━━━━━━━━ 首部 function FormatFloat(const Format: string; Value: Extended): string; $[SysUtils.pas 功能 返回浮點數類型以指定格式字符串Format轉換成字符串 說明 FormatFloat(',.00', 1234567890) = '1,234,567,890.00' 參考 function SysUtils.FloatToTextFmt 例子 Edit1.Text := FormatFloat(Edit2.Text, StrToFloatDef(Edit3.Text, 0)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function FormatCurr(const Format: string; Value: Currency): string; $[SysUtils.pas 功能 返回貨幣類型以指定格式字符串Format轉換成字符串 說明 FormatCurr(',.00', 1234567890) = '1,234,567,890.00' 參考 function SysUtils.FloatToTextFmt 例子 Edit1.Text := FormatCurr(Edit2.Text, StrToCurrDef(Edit3.Text, 0)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function FloatToTextFmt(Buf: PChar; const Value; ValueType: TFloatValue; Format: PChar): Integer; $[SysUtils.pas 功能 返回浮點數以指定格式字符串Format轉換成指針字符串的內存大小 說明 ValueType指定無類型參數Value的類型 參考 例子 ///////Begin FloatToTextFmt procedure TForm1.Button1Click(Sender: TObject); var vBuffer: array[0..255] of Char; E: Extended; begin E := StrToFloatDef(Edit1.Text, 0); SpinEdit1.Value := FloatToTextFmt(vBuffer, E, fvExtended, PChar(Edit2.Text)); Edit3.Text := Copy(vBuffer, 1, SpinEdit1.Value); end; ///////End FloatToTextFmt ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToFloat(const S: string): Extended; $[SysUtils.pas 功能 返回字符串S轉換成浮點數 說明 字符串非浮點數表達時將引起異常 參考 function SysUtils.TextToFloat 例子 var E: Extended; begin E := StrToFloat(Edit1.Text); end; ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToFloatDef(const S: string; const Default: Extended): Extended; $[SysUtils.pas 功能 返回字符串S轉換成浮點數 說明 字符串非浮點數表達時則返回默認值Default 參考 function SysUtils.TextToFloat 例子 var E: Extended; begin E := StrToFloatDef(Edit1.Text, 0); end; ━━━━━━━━━━━━━━━━━━━━━ 首部 function TryStrToFloat(const S: string; out Value: Extended): Boolean; overload; $[SysUtils.pas 首部 function TryStrToFloat(const S: string; out Value: Single): Boolean; overload; $[SysUtils.pas 首部 function TryStrToFloat(const S: string; out Value: Double): Boolean; overload; $[SysUtils.pas 功能 返回字符串S轉換成浮點數Value是否成功 說明 字符串非浮點數表達時返回False並且Value將輸出爲不確定的值 參考 function SysUtils.TextToFloat 例子 ///////Begin TryStrToFloat procedure TForm1.Button1Click(Sender: TObject); var E: Extended; begin CheckBox1.Checked := TryStrToFloat(Edit1.Text, E); Edit2.Text := FormatFloat('', E); end; ///////End TryStrToFloat ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToCurr(const S: string): Currency; $[SysUtils.pas 功能 返回字符串S轉換成貨幣數 說明 字符串非貨幣數表達時將引起異常 參考 function SysUtils.TextToFloat 例子 var C: Currency; begin C := StrToCurr(Edit1.Text); end; ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToCurrDef(const S: string; const Default: Currency): Currency; $[SysUtils.pas 功能 返回字符串S轉換成貨幣數 說明 字符串非貨幣數表達時則返回默認值Default 參考 function SysUtils.TextToFloat 例子 var C: Currency; begin C := StrToCurrDef(Edit1.Text, 0); end; ━━━━━━━━━━━━━━━━━━━━━ 首部 function TryStrToCurr(const S: string; out Value: Currency): Boolean; $[SysUtils.pas 功能 返回字符串S轉換成貨幣數Value是否成功 說明 字符串非貨幣數表達時返回False並且Value將輸出爲不確定的值 參考 function SysUtils.TextToFloat 例子 ///////Begin TryStrToCurr procedure TForm1.Button1Click(Sender: TObject); var C: Currency; begin CheckBox1.Checked := TryStrToCurr(Edit1.Text, C); Edit2.Text := FormatCurr('', C); end; ///////End TryStrToCurr ━━━━━━━━━━━━━━━━━━━━━ 首部 function TextToFloat(Buffer: PChar; var Value; ValueType: TFloatValue): Boolean; $[SysUtils.pas 功能 返回將指針字符串Buffer轉換成無類型變量Value 說明 ValueType指定無類型參數Value的類型 參考 例子 ///////Begin TextToFloat procedure TForm1.Button1Click(Sender: TObject); var E: Extended; begin CheckBox1.Checked := TextToFloat(PChar(Edit1.Text), E, fvExtended); Edit2.Text := FormatFloat('', E); end; ///////End TextToFloat ━━━━━━━━━━━━━━━━━━━━━ 首部 function DateToStr(const DateTime: TDateTime): string; $[SysUtils.pas 功能 返回日期DateTime轉換成字符串 說明 轉換格式由系統變量ShortDateFormat控制 參考 function SysUtils.DateTimeToString;var SysUtils.ShortDateFormat 例子 Edit1.Text := DateToStr(Date); ━━━━━━━━━━━━━━━━━━━━━ 首部 function TimeToStr(const DateTime: TDateTime): string; $[SysUtils.pas 功能 返回時間DateTime轉換成字符串 說明 轉換格式由系統變量LongTimeFormat控制 參考 function SysUtils.DateTimeToString;var SysUtils.LongTimeFormat 例子 Edit1.Text := TimeToStr(Date); ━━━━━━━━━━━━━━━━━━━━━ 首部 function DateTimeToStr(const DateTime: TDateTime): string; $[SysUtils.pas 功能 返回日期時間DateTime轉換成字符串 說明 轉換格式由系統變量ShortDateFormat和LongTimeFormat控制 參考 function SysUtils.DateTimeToString 例子 Edit1.Text := DateTimeToStr(Now); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToDate(const S: string): TDateTime; $[SysUtils.pas 功能 返回字符串S轉換成日期 說明 字符非日期表達時將引起異常 參考 function SysUtils.TryStrToDate 例子 DateTimePicker1.Date := StrToDate(Edit1.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToDateDef(const S: string; const Default: TDateTime): TDateTime; $[SysUtils.pas 功能 返回字符串S轉換成日期 說明 字符非日期表達時則返回默認值Default 參考 function SysUtils.TryStrToDate 例子 DateTimePicker1.Date := StrToDateDef(Edit1.Text, Date); ━━━━━━━━━━━━━━━━━━━━━ 首部 function TryStrToDate(const S: string; out Value: TDateTime): Boolean; $[SysUtils.pas 功能 返回字符串S轉換成日期Value是否成功 說明 字符非日期表達時返回False並且Value將輸出爲0 參考 例子 ///////Begin TryStrToDate procedure TForm1.Button1Click(Sender: TObject); var vDateTime: TDateTime; begin CheckBox1.Checked := TryStrToDate(Edit1.Text, vDateTime); DateTimePicker1.Date := vDateTime; end; ///////End TryStrToDate ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToTime(const S: string): TDateTime; $[SysUtils.pas 功能 返回字符串S轉換成時間 說明 字符非時間表達時將引起異常 參考 function SysUtils.TryStrToTime 例子 DateTimePicker1.Time := StrToTime(Edit1.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToTimeDef(const S: string; const Default: TDateTime): TDateTime; $[SysUtils.pas 功能 返回字符串S轉換成時間 說明 字符非時間表達時則返回默認值Default 參考 function SysUtils.TryStrToTime 例子 DateTimePicker1.Time := StrToTimeDef(Edit1.Text, Time); ━━━━━━━━━━━━━━━━━━━━━ 首部 function TryStrToTime(const S: string; out Value: TDateTime): Boolean; $[SysUtils.pas 功能 返回字符串S轉換成時間Value是否成功 說明 字符非時間表達時返回False並且Value將輸出爲0 參考 例子 ///////Begin TryStrToTime procedure TForm1.Button1Click(Sender: TObject); var vDateTime: TDateTime; begin CheckBox1.Checked := TryStrToTime(Edit1.Text, vDateTime); DateTimePicker1.Time := vDateTime; end; ///////End TryStrToTime ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToDateTime(const S: string): TDateTime; $[SysUtils.pas 功能 返回字符串S轉換成日期時間 說明 字符非日期時間表達時將引起異常 參考 function SysUtils.TryStrToDateTime 例子 Edit1.Text := DateTimeToStr(StrToDateTime(Edit2.Text)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToDateTimeDef(const S: string; const Default: TDateTime): TDateTime; $[SysUtils.pas 功能 返回字符串S轉換成日期時間 說明 字符非日期時間表達時則返回默認值Default 參考 function SysUtils.TryStrToDateTime 例子 Edit1.Text := DateTimeToStr(StrToDateTimeDef(Edit2.Text, Now)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function TryStrToDateTime(const S: string; out Value: TDateTime): Boolean; $[SysUtils.pas 功能 返回字符串S轉換成日期時間Value是否成功 說明 字符非日期時間表達時返回False並且Value將輸出爲0 參考 例子 ///////Begin TryStrToDateTime procedure TForm1.Button1Click(Sender: TObject); var vDateTime: TDateTime; begin CheckBox1.Checked := TryStrToDateTime(Edit1.Text, vDateTime); Edit2.Text := DateTimeToStr(vDateTime); end; ///////End TryStrToDateTime ━━━━━━━━━━━━━━━━━━━━━ 首部 procedure DateTimeToString(var Result: string; const Format: string; DateTime: TDateTime); $[SysUtils.pas 功能 用指定的格式Format來格式化日期時間DateTime並返回到字符串Result中 說明 <參見FormatDateTime> 參考 function System.SetString 例子 <參見FormatDateTime> ━━━━━━━━━━━━━━━━━━━━━ 首部 function GetLocaleStr(Locale, LocaleType: Integer; const Default: string): string; platform; $[SysUtils.pas 功能 返回當前系統指定參數的字符串值 說明 GetLocaleStr(GetThreadLocale, LOCALE_SLANGUAGE, '') = '中文(中國)' 參考 function Windows.GetLocaleInfo 例子 Edit1.Text := GetLocaleStr(GetThreadLocale, SpinEdit1.Value, ''); ━━━━━━━━━━━━━━━━━━━━━ 首部 function GetLocaleChar(Locale, LocaleType: Integer; Default: Char): Char; platform; $[SysUtils.pas 功能 返回當前系統指定參數的字符值 說明 GetLocaleChar(GetThreadLocale, LOCALE_STHOUSAND, #0) = ',' 參考 function Windows.GetLocaleInfo 例子 Edit1.Text := GetLocaleChar(GetThreadLocale, LOCALE_SLANGUAGE, #0); ━━━━━━━━━━━━━━━━━━━━━ 首部 function ByteType(const S: string; Index: Integer): TMbcsByteType; $[SysUtils.pas 功能 返回字符串S位置Index上的字符在MBCS中類型 說明 多字節字符系統:Multi-Byte Character System (MBCS) 參考 var SysUtils.SysLocale 例子 SpinEdit1.Value := Ord(ByteType(Edit1.Text, SpinEdit2.Value)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrByteType(Str: PChar; Index: Cardinal): TMbcsByteType; $[SysUtils.pas 功能 返回指針字符串Str位置Index上的字符在MBCS中類型 說明 Index從0開始 參考 var SysUtils.SysLocale 例子 SpinEdit1.Value := Ord(StrByteType(PChar(Edit1.Text), SpinEdit2.Value)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function ByteToCharLen(const S: string; MaxLen: Integer): Integer; $[SysUtils.pas 功能 返回字符串S中有多少個多字節字符 說明 MaxLen指定處理字符個數 參考 function SysUtils.ByteToCharIndex 例子 SpinEdit1.Value := ByteToCharLen(Edit1.Text, SpinEdit2.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function CharToByteLen(const S: string; MaxLen: Integer): Integer; $[SysUtils.pas 功能 返回字符串S中有多少個字符 說明 MaxLen指定處理多字節字符個數 參考 var SysUtils.SysLocale 例子 SpinEdit1.Value := CharToByteLen(Edit1.Text, SpinEdit2.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function ByteToCharIndex(const S: string; Index: Integer): Integer; $[SysUtils.pas 功能 返回字符位置對應的多字節字符位置 說明 ByteToCharIndex('你好', 2) = 1;ByteToCharIndex('你好', 3) = 2 參考 function SysUtils.NextCharIndex 例子 SpinEdit1.Value := ByteToCharIndex(Edit1.Text, SpinEdit2.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function CharToByteIndex(const S: string; Index: Integer): Integer; $[SysUtils.pas 功能 返回多字節字符位置對應的字符起始位置 說明 CharToByteIndex('你好', 1) = 1;CharToByteIndex('你好', 2) = 3 參考 function System.Length 例子 SpinEdit1.Value := CharToByteIndex(Edit1.Text, SpinEdit2.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrCharLength(const Str: PChar): Integer; $[SysUtils.pas 功能 返回第一個字符的寬度 說明 參數爲空則返回0 參考 function Windows.CharNext 例子 SpinEdit1.Value := StrCharLength(PChar(Edit1.Text)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrNextChar(const Str: PChar): PChar; $[SysUtils.pas 功能 返回字符指針Str的下一個字符指針 說明 StrNextChar('1234') = '234'; 參考 function Windows.CharNext 例子 Edit2.Text := StrNextChar(PChar(Edit1.Text)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function CharLength(const S: String; Index: Integer): Integer; $[SysUtils.pas 功能 返回字符串中指定位置的字符寬度 說明 CharLength('English漢', 1) = 1;CharLength('English漢', 8) = 2 參考 function System.Assert;function SysUtils.StrCharLength 例子 SpinEdit1.Value := CharLength(Edit1.Text, SpinEdit2.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function NextCharIndex(const S: String; Index: Integer): Integer; $[SysUtils.pas 功能 返回下一個字符的位置 說明 CharLength('你好', 1) = 3;CharLength('你好', 3) = 5 參考 function System.Assert;function SysUtils.StrCharLength 例子 SpinEdit1.Value := NextCharIndex(Edit1.Text, SpinEdit2.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function IsPathDelimiter(const S: string; Index: Integer): Boolean; $[SysUtils.pas 功能 返回字符串S中指定位置Index上是否是一個路徑分隔符 說明 IsPathDelimiter('C:/Windows', 3) = True 參考 const SysUtils.PathDelim;function SysUtils.ByteType 例子 CheckBox1.Checked := IsPathDelimiter(Edit1.Text, SpinEdit1.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function IsDelimiter(const Delimiters, S: string; Index: Integer): Boolean; $[SysUtils.pas 功能 返回字符串S中指定位置Index上是否是一個分隔符Delimiters 說明 IsDelimiter('@', '[email protected]', 8) = True 參考 function SysUtils.ByteType 例子 CheckBox1.Checked := IsDelimiter(Edit1.Text, Edit2.Text, SpinEdit1.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function IncludeTrailingPathDelimiter(const S: string): string; $[SysUtils.pas 功能 返回包括最後路徑分隔符 說明 最後一個字符是路徑分隔符則不變;否則加上一個路徑分隔符返回 參考 function SysUtils.IsPathDelimiter;function System.Length 例子 Edit1.Text := IncludeTrailingPathDelimiter(Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function IncludeTrailingBackslash(const S: string): string; platform; $[SysUtils.pas 功能 返回包括最後斜線 說明 Result := IncludeTrailingPathDelimiter(S); 參考 function SysUtils.IncludeTrailingPathDelimiter 例子 Edit1.Text := IncludeTrailingBackslash(Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function ExcludeTrailingPathDelimiter(const S: string): string; $[SysUtils.pas 功能 返回排除最後路徑分隔符 說明 最後一個字符不是路徑分隔符則不變;否則減去最後的路徑分隔符返回 參考 function SysUtils.IsPathDelimiter;function System.Length;function System.SetLength 例子 Edit1.Text := ExcludeTrailingPathDelimiter(Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function ExcludeTrailingBackslash(const S: string): string; platform; $[SysUtils.pas 功能 返回排除最後斜線 說明 Result := ExcludeTrailingPathDelimiter(S) 參考 function SysUtils.ExcludeTrailingPathDelimiter 例子 Edit1.Text := ExcludeTrailingBackslash(Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function LastDelimiter(const Delimiters, S: string): Integer; $[SysUtils.pas 功能 返回最後一個分隔符的位置 說明 LastDelimiter('.', 'kingron.myetang.com') = 16 參考 function SysUtils.StrScan;function SysUtils.ByteType 例子 SpinEdit1.Value := LastDelimiter(Edit1.Text, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiCompareFileName(const S1, S2: string): Integer; $[SysUtils.pas 功能 返回比較兩個文件名 說明 當S1>S2返回值>0;當S1 參考 fuction Windows.Succeeded 例子 Edit2.Text := GUIDToString(StringToGUID(Edit1.Text)); ━━━━━━━━━━━━━━━━━━━━━ Delphi函數手冊 abort 函數 引起放棄的意外處理 abs 函數 絕對值函數 addexitproc 函數 將一過程添加到運行時庫的結束過程表中 addr 函數 返回指定對象的地址 adjustlinebreaks 函數 將給定字符串的行分隔符調整爲cr/lf序列 align 屬性 使控件位於窗口某部分 alignment 屬性 控件標籤的文字位置 allocmem 函數 在堆棧上分配給定大小的塊 allowgrayed 屬性 允許一個灰度選擇 ansicomparestr 函數 比較字符串(區分大小寫) ansicomparetext 函數 比較字符串(不區分大小寫) ansilowercase 函數 將字符轉換爲小寫 ansiuppercase 函數 將字符轉換爲大寫 append 函數 以附加的方式打開已有的文件 arctan 函數 餘切函數 assignfile 函數 給文件變量賦一外部文件名 assigned 函數 測試函數或過程變量是否爲空 autosize 屬性 自動控制標籤的大小 backgrounddi2001.jpg 屬性 背景色 beginthread 函數 以適當的方式建立用於內存管理的線程 bevelinner 屬性 控件方框的內框方式 bevelouter 屬性 控件方框的外框方式 bevelwidth 屬性 控件方框的外框寬度 blockread 函數 讀一個或多個記錄到變量中 blockwrite 函數 從變量中寫一個或多個記錄 borderstyle 屬性 邊界類型 borderwidth 屬性 邊界寬度 break 命令 終止for、while、repeat循環語句 brush 屬性 畫刷 caption 屬性 標籤文字的內容 changefileext 函數 改變文件的後綴 chdir 函數 改變當前目錄 checked 屬性 確定複選框選中狀態 chr 函數 返回指定序數的字符 closefile 命令 關閉打開的文件 color 屬性 標籤的顏色 columns 屬性 顯示的列數 comparestr 函數 比較字符串(區分大小寫) concat 函數 合併字符串 continue 命令 繼續for、while、repeat的下一個循環 copy 函數 返回一字符串的子串 cos 函數 餘弦函數 ctl3d 屬性 是否具有3d效果 cursor 屬性 鼠標指針移入後的形狀 date 函數 返回當前的日期 datetimetofiledate 函數 將delphi的日期格式轉換爲dos的日期格式 datetimetostr 函數 將日期時間格式轉換爲字符串 datetimetostring 函數 將日期時間格式轉換爲字符串 datetostr 函數 將日期格式轉換爲字符串 dayofweek 函數 返回星期的數值 dec 函數 遞減變量值 decodedate 函數 將日期格式分解爲年月日 decodetime 函數 將時間格式分解爲時、分、秒、毫秒 delete 函數 從字符串中刪除子串 deletefile 命令 刪除文件 diskfree 函數 返回剩餘磁盤空間的大小 disksize 函數 返回指定磁盤的容量 dispose 函數 釋放動態變量所佔的空間 disposestr 函數 釋放字符串在堆棧中的內存空間 ditherbackgrounddi2001.jpg?使背景色的色彩加重或減少50% dragcursor 屬性 當鼠標按下時光標的形狀 dragmode 屬性 按動的作用方式 dropdowncount 屬性 容許的顯示數據項的數目 editmask 屬性 編輯模式 enabled 屬性 是否使標籤呈現打開狀態 encodedate 函數 將年月日合成爲日期格式 encodetime 函數 將時、分、秒、毫秒合成爲時間格式 endmargin 屬性 末尾邊緣 eof 函數 對有類型或無類型文件測試是否到文件尾 eoln 函數 返回文本文件的行結束狀態 erase 命令 刪除外部文件 exceptaddr 函數 返回引起當前意外的地址 exclude 函數 從集合中刪除一些元素 exceptobject 函數 返回當前意外的索引 exit 命令 立即從當前的語句塊中退出 exp 函數 指數函數 expandfilename 函數 返回包含絕對路徑的字符串 extendedselect 屬性 是否允許存在選擇模式,true時,multiselect纔有意義 extractfiledir 函數 返回驅動器和路徑 extractfileext 函數 返回文件的後綴 extractfilename 函數 返回文件名 extractfilepath 函數 返回指定文件的路徑 fileage 函數 返回文件已存在的時間 fileclose 命令 關閉指定的文件 filecreate 命令 用指定的文件名建立新文件 filedatetodatetime 函數 將dos的日期格式轉換爲delphi的日期格式 fileexists 函數 檢查文件是否存在 filegatattr 函數 返回文件的屬性 filegetdate 函數 返回文件的dos日期時間標記 fileopen 命令 用指定的存取模式打開指定的文件 filepos 函數 返回文件的當前指針位置 fileread 命令 從指定的文件讀取 filesearch 命令 在目錄中搜索指定的文件 fileseek 函數 改變文件的指針 filesetattr 函數 設置文件屬性 filesetdate 函數 設置文件的dos日期時間標記 filesize 函數 返回當前文件的大小 filewrite 函數 對指定的文件做寫操作 fillchar 函數 用指定的值填充連續字節的數 findclose 命令 終止findfirst/findnext序列 findfirst 命令 對指定的文件名及屬性搜索目錄 findnext 命令 返回與文件名及屬性匹配的下一入口 floattodecimal 函數 將浮點數轉換爲十進制數 floattostrf 函數 將浮點數轉換爲字符串 floattostr 函數 將浮點數轉換爲字符串 floattotext 函數 將給定的浮點數轉換爲十進制數 floattotextfmt 函數 將給定的浮點數轉換爲十進制數 flush 函數 將緩衝區的內容刷新到輸出的文本文件中 fmtloadstr 函數 從程序的資源字符串表中裝載字符串 fmtstr 函數 格式化一系列的參數,其結果以參數result返回 font 屬性 設置字體 format 函數 格式化一系列的參數並返回pascal字符串 formatbuf 函數 格式化一系列的參數 formatdatetime 函數 用指定的格式來格式化日期和時間 formatfloat 函數 指定浮點數格式 frac 函數 返回參數的小數部分 freemem 函數 按給定大小釋放動態變量所佔的空間 getdir 返回指定驅動器的當前目錄 getheapstatus 返回內存管理器的當前狀態 getmem 建立一指定大小的動態變量,並將指針指向該處 getmemorymanager 返回內存管理器的入口點 glyph 函數 按鈕上的圖象 halt 停止程序的執行並返回到操作系統 hi 返回參數的高地址位 high 返回參數的上限值 hint 屬性 提示信息 int 返回參數的整數部分 include 添加元素到集合中 insert 在字符串中插入子串 inttohex 將整型數轉換爲十六進制數 inttostr 將整型數轉換爲字符串 ioresult 返回最新的i/o操作完成狀態 isvalidident 測試字符串是否爲有效的標識符 items 屬性 默認顯示的節點 kind 屬性 擺放樣式 largechange 屬性 最大改變值 layout 屬性 圖象佈局 length 函數 返回字符串的動態長度 lines 屬性 缺省顯示內容 ln 函數 自然對數函數 lo 函數 返回參數的低地址位 loadstr 函數 從應用程序的可執行文件中裝載字符資源 lowercase 函數 將給定的字符串變爲小寫 low 函數 返回參數的下限值 max 屬性 最大值 maxlength 屬性 最大長度 min 屬性 最小值 mkdir 命令 建立一子目錄 move 函數 從源到目標複製字節 multiselect 屬性 允許同時選擇幾個數據項 name 屬性 控件的名字 new 函數 建立新的動態變量並設置一指針變量指向他 newstr 函數 在堆棧上分配新的字符串 now 函數 返回當前的日期和時間 odd 測試參數是否爲奇數 onactivate 事件 焦點移到窗體上時觸發 onclick 事件 單擊窗體空白區域觸發 ondblclick 事件 雙擊窗體空白區域觸發 onclosequery 事件 使用者試圖關閉窗體觸發 onclose 事件 窗體關閉後才觸發 oncreate 事件 窗體第一次創建時觸發 ondeactivate 事件 用戶切換到另一應用程序觸發 ondragdrop 事件 鼠標拖放操作結束時觸發 ondragover 事件 有其他控件從他上面移過觸發 onmousedown 事件 按下鼠標鍵時觸發 onmouseup 事件 釋放鼠標鍵時觸發 onmousemove 事件 移動鼠標時觸發 onhide 事件 隱藏窗體時觸發 onkeydown 事件 按下鍵盤某鍵時觸發 onkeypress 事件 按下鍵盤上的單個字符鍵時觸發 onkeyup 事件 釋放鍵盤上的某鍵時觸發 onpaint 事件 窗體上有新部分暴露出來觸發 onresize 事件 重新調整窗體大小觸發 onshow 事件 在窗體實際顯示之前瞬間觸發 ord 返回序數類的序數 outlinestyle 屬性 類型 outofmemoryerror 引起outofmemory意外 pageindex 屬性 頁索引 pages 屬性 頁 paramcount 函數 返回在命令行上傳遞給程序的參數數量 paramstr 函數 返回指定的命令行參數 pen 屬性 畫刷設置 pi 函數 返回圓周率pi picture 屬性 顯示圖象 pictureclosed 屬性 設置closed位圖 pictureleaf 屬性 設置leaf位圖 pictureminus 屬性 設置minus位圖 pictureopen 屬性 設置open位圖 pictureplus 屬性 設置plus位圖 pos 函數 在字符串中搜索子串 pred 函數 返回先前的參數 random 函數 返回一隨機函數 randomize 函數 用一隨機數初始化內置的隨機數生成器 read 函數 對有格式的文件,讀一文件組件到變量中; 對文本文件,讀一個或多個值到一個或多個變量中 readln 函數 執行read過程,然後跳到文件下一行 readonly 屬性 只讀屬性 reallocmem 函數 分配一動態變量 rename 函數 重命名外部文件 renamefile 函數 對文件重命名 reset 函數 打開已有的文件 rewrite 函數 建立並打開一新的文件 rmdir 函數 刪除空的子目錄 round 函數 將實數值舍入爲整型值 runerror 函數 停止程序的執行 scrollbars 屬性 滾動條狀態 seek 函數 將文件的當前指針移動到指定的組件上 seekeof 函數 返回文件的文件結束狀態 seekeoln 函數 返回文件的行結束狀態 selectedcolor 屬性 選中顏色 setmemorymanager 函數 設置內存管理器的入口點 settextbuf 函數 給文本文件指定i/o緩衝區 shape 屬性 顯示的形狀 showexception 函數 顯示意外消息與地址 sin 函數 正弦函數 sizeof 函數 返回參數所佔的字節數 smallchange 屬性 最小改變值 sorted 屬性 是否允許排序 sqr 函數 平方函數 sqrt 函數 平方根函數 startmargin 屬性 開始邊緣 state 屬性 控件當前狀態 str 函數 將數值轉換爲字符串 stralloc 函數 給以null結束的字符串分配最大長度-1的緩衝區 strbufsize 函數 返回存儲在由stralloc分配的字符緩衝區的最大字符數 strcat 函數 將一字符串附加到另一字符串尾並返回合併的字符串 strcomp 函數 比較兩個字符串 strcopy 函數 將一個字符串複製到另一個字符串中 strdispose 函數 釋放堆棧上的字符串 strecopy 函數 將一字符串複製到另一個字符串並返回結果字符串尾部的指針 strend 函數 返回指向字符串尾部的指針 stretch 屬性 自動適應控件的大小 strfmt 函數 格式化一系列的參數 stricomp 函數 比較兩個字符串(不區分大小寫) stringtowidechar 函數 將ansi字符串轉換爲unicode字符串 strlcat 函數 將一字符串中的字符附加到另一字符串尾並返回合併的字符串 strlcomp 函數 以最大長度比較兩個字符串 strlcopy 函數 將一個字符串中的字符複製到另一個字符串中 strlen 函數 返回字符串中的字符數 strlfmt 函數 格式化一系列的參數,其結果中包含有指向目標緩衝區的指針 strlicomp 函數 以最大長度比較兩個字符串(不區分大小寫) strlower 函數 將字符串中的字符轉換爲小寫 strmove 函數 將一個字符串中的字符複製到另一個字符串中 strnew 函數 在堆棧上分配一個字符串 strpas 函數 將以null結束的字符串轉換爲pascal類的字符串 strpcopy 函數 將pascal類的字符串複製爲以null結束的字符串 strplcopy 函數 從pascal類的最大長度字符串複製爲以null結束的字符串 strpos 函數 返回一個字符串在另一個字符串中首次出現指針 strrscan 函數 返回字符串中最後出現字符的指針 strscan 函數 返回字符串中出現首字符的指針 strtodate 函數 將字符串轉換爲日期格式 strtodatetime 函數 將字符串轉換爲日期/時間格式 strtofloat 函數 將給定的字符串轉換爲浮點數 strtoint 函數 將字符串轉換爲整型 strtointdef 函數 將字符串轉換爲整型或默認值 strtotime 函數 將字符串轉換爲時間格式 strupper 函數 將字符串中的字符轉換爲大寫 style 屬性 類型選擇 suce 函數 返回後繼的參數 swap 函數 交換參數的高低地址位 tabs 屬性 標記每一項的內容 tabindex 屬性 標記索引 text 屬性 顯示的文本 texttofloat 函數 將字符串(以null結束的格式)轉換爲浮點數 time 函數 返回當前的時間 timetostr 函數 將時間格式轉換爲字符串 trim 函數 從給定的字符串中刪除前導和尾部的空格及控制字符 trimleft 函數 從給定的字符串中刪除首部的空格及控制字符 trimright 函數 從給定的字符串中刪除尾部的空格及控制字符 trunc 函數 將實型值截取爲整型值 truncate 函數 截去當前文件位置後的內容 unselectedcolor 屬性 未選中顏色 upcase 將字符轉換爲大寫 uppercase 將給定的字符串變爲大寫 val 函數 將字符串轉換爲整型值 vararraycreate 函數 以給定的界限和維數建立變體數組 vararraydimcount 函數 返回給定變體的維數 vararrayhighbound 函數 返回給定變體數組維數的上界 vararraylock 函數 鎖定給定的變體數組 vararraylowbound 函數 返回給定變體數組維數的下界 vararrayof 函數 返回指定變體的數組元素 vararrayredim 函數 通過改變上限來調整變體的大小 vararrayunlock 函數 解鎖指定的變體數組 varastype 函數 將變體轉換爲指定的類型 varcase 函數 將變體轉換爲指定的類型並保存他 varclear 函數 清除指定的變體 varcopy 函數 將指定的變體複製爲指定的變體 varformdatetime 函數 返回包含日期時間的變體 varisarray 函數 測試變體是否爲數組 varisempty 函數 測試變體是否爲unassigned varisnull 函數 測試變體是否爲null vartodatetime 函數 將給定的變體轉換爲日期時間 vartype 函數 將變體轉換爲指定的類型並保存他 visible 屬性 控件的可見性 wantreturns 屬性 爲true時,按回車鍵產生一個回車符; 爲false時,按下ctrl+enter才產生回車符 write 命令 對有格式的文件,寫一變量到文件組件中; 對文本文件,寫一個或多個值到文件中 writeln 命令 執行write過程,然後輸出一行結束標誌 widecharlentostring 函數 將ansi字符串轉換爲unicode字符串 widecharlentostrwar 函數 將unicode字符串轉換爲ansi字符串變量 widechartostring 函數 將unicode字符串轉換爲ansi字符串 widechartostrvar 函數 將unicode字符串轉換爲ansi字符串變量 uses StrUtils; 【字符串函數大全】 首部 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); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiContainsText(const AText, ASubText: string): Boolean; $[StrUtils.pas 功能 返回字符串AText是否包含子串ASubText 說明 不區分大小寫 參考 function StrUtils.AnsiUppercase; function StrUtils.AnsiPos 例子 CheckBox1.Checked := AnsiContainsText(Edit1.Text, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiStartsText(const ASubText, AText: string): Boolean; $[StrUtils.pas 功能 返回字符串AText是否以子串ASubText開頭 說明 不區分大小寫 參考 function Windows.CompareString 例子 CheckBox1.Checked := AnsiStartsText(Edit1.Text, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiEndsText(const ASubText, AText: string): Boolean; $[StrUtils.pas 功能 返回字符串AText是否以子串ASubText結尾 說明 不區分大小寫 參考 function Windows.CompareString 例子 CheckBox1.Checked := AnsiEndsText(Edit1.Text, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiReplaceText(const AText, AFromText, AToText: string): string; $[StrUtils.pas 功能 返回字符串AText中用子串AFromText替換成子串AToText的結果 說明 不區分大小寫 參考 function SysUtils.StringReplace; type SysUtils.TReplaceFlags 例子 Edit4.Text := AnsiReplaceText(Edit1.Text, Edit2.Text, Edit3.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiMatchText(const AText: string; const AValues: array of string): Boolean; $[StrUtils.pas 功能 返回字符串數組AValues中是否包含字符串AText 說明 不區分大小寫 參考 function StrUtils.AnsiIndexText 例子 CheckBox1.Checked := AnsiMatchText(Edit1.Text, ['a1', 'a2', 'a3', 'a4']); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiIndexText(const AText: string; const AValues: array of string): Integer; $[StrUtils.pas 功能 返回字符串AText在字符串數組AValues中的位置 說明 不區分大小寫;如果不包含則返回-1 參考 function SysUtils.AnsiSameText 例子 SpinEdit1.Value := AnsiIndexText(Edit1.Text, ['a1', 'a2', 'a3', 'a4']); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiContainsStr(const AText, ASubText: string): Boolean; $[StrUtils.pas 功能 返回字符串AText是否包含子串ASubText 說明 區分大小寫 參考 function StrUtils.AnsiPos 例子 CheckBox1.Checked := AnsiContainsStr(Edit1.Text, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiStartsStr(const ASubText, AText: string): Boolean; $[StrUtils.pas 功能 返回字符串AText是否以子串ASubText開頭 說明 區分大小寫 參考 function SysUtils.AnsiSameStr 例子 CheckBox1.Checked := AnsiStartsStr(Edit1.Text, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiEndsStr(const ASubText, AText: string): Boolean; $[StrUtils.pas 功能 返回字符串AText是否以子串ASubText結尾 說明 區分大小寫 參考 function SysUtils.AnsiSameStr 例子 CheckBox1.Checked := AnsiEndsStr(Edit1.Text, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiReplaceStr(const AText, AFromText, AToText: string): string; $[StrUtils.pas 功能 返回字符串AText中用子串AFromText替換成子串AToText的結果 說明 區分大小寫 參考 function SysUtils.StringReplace; type SysUtils.TReplaceFlags 例子 Edit4.Text := AnsiReplaceStr(Edit1.Text, Edit2.Text, Edit3.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiMatchStr(const AText: string; const AValues: array of string): Boolean; $[StrUtils.pas 功能 返回字符串數組AValues中是否包含字符串AText 說明 區分大小寫 參考 function StrUtils.AnsiIndexStr 例子 CheckBox1.Checked := AnsiMatchStr(Edit1.Text, ['a1', 'a2', 'a3', 'a4']); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiIndexStr(const AText: string; const AValues: array of string): Integer; $[StrUtils.pas 功能 返回字符串AText在字符串數組AValues中的位置 說明 區分大小寫 參考 function SysUtils.AnsiSameStr 例子 SpinEdit1.Value := AnsiIndexStr(Edit1.Text, ['a1', 'a2', 'a3', 'a4']); ━━━━━━━━━━━━━━━━━━━━━ 首部 function DupeString(const AText: string; ACount: Integer): string; $[StrUtils.pas 功能 返回字符串AText的ACount個複本 說明 當ACount爲0時返回'' 參考 function System.SetLength 例子 Edit3.Text := DupeString(Edit1.Text, SpinEdit1.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function ReverseString(const AText: string): string; $[StrUtils.pas 功能 返回字符串AText的反序 說明 ReverseString('1234') = '4321' 參考 function System.SetLength 例子 Edit3.Text := ReverseString(Edit1.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StuffString(const AText: string; AStart, ALength: Cardinal; const ASubText: string): string; $[StrUtils.pas 功能 返回嵌套字符串 說明 AStart:嵌套開始位置;ALength:嵌套長度;StuffString('abcd', 2, 0, '12') = 'a12bcd' 參考 function System.Copy 例子 Edit3.Text := StuffString(Edit1.Text, SpinEdit1.Value, SpinEdit2.Value, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function RandomFrom(const AValues: array of string): string; overload; $[StrUtils.pas 功能 隨機返回字符串數組AValues中的一個元素 說明 之前建議執行Randomize 參考 function System.Random 例子 Randomize; Edit3.Text := RandomFrom(['a1', 'a2', 'a3', 'a4']); ━━━━━━━━━━━━━━━━━━━━━ 首部 function IfThen(AValue: Boolean; const ATrue: string; AFalse: string = ''): string; overload; $[StrUtils.pas 功能 返回指定的邏輯字符串 說明 IfThen(True, '是', '否') = '是';IfThen(False, '是', '否') = '否' 參考 例子 Edit3.Text := IfThen(CheckBox1.Checked, Edit1.Text, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function LeftStr(const AText: string; const ACount: Integer): string; $[StrUtils.pas 功能 返回字符串AText左邊的ACount個字符 說明 LeftStr('123456', 3) = '123' 參考 function System.Copy 例子 Edit3.Text := LeftStr(Edit1.Text, SpinEdit1.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 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 功能 返回第一個搜索到的指針位置 說明 這函數常用於文本中搜索字符串 參考 例子 ///////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 參考 例子 Edit2.Text := Soundex(Edit1.Text, SpinEdit1.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function SoundexInt(const AText: string; ALength: TSoundexIntLength = 4): Integer; $[StrUtils.pas 功能 返回探測整數 說明 ALength的值越大解碼準確率越高 參考 例子 SpinEdit2.Value := SoundexInt(Edit1.Text, SpinEdit1.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function DecodeSoundexInt(AValue: Integer): string; $[StrUtils.pas 功能 返回探測整數的解碼 說明 DecodeSoundexInt(SoundexInt('hello')) 相當於 Soundex('hello') 參考 例子 Edit2.Text := DecodeSoundexInt(SpinEdit2.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function SoundexWord(const AText: string): Word; $[StrUtils.pas 功能 返回探測文字數值 說明 沒有參數ALength已經固定爲4 參考 例子 SpinEdit2.Value := SoundexWord(Edit1.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function DecodeSoundexWord(AValue: Word): string; $[StrUtils.pas 功能 返回探測文字數值的解碼 說明 DecodeSoundexWord(SoundexWord('hello')) 相當於 Soundex('hello') 參考 例子 Edit2.Text := DecodeSoundexWord(SpinEdit2.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function SoundexSimilar(const AText, AOther: string; ALength: TSoundexLength = 4): Boolean; $[StrUtils.pas 功能 返回兩個字符串的探測字符串是否相同 說明 Result := Soundex(AText, ALength) = Soundex(AOther, ALength) 參考 例子 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 P := nil; AssignStr(P, Edit1.Text); Edit2.Text := P^; DisposeStr(P); end; ////////End AssignStr ━━━━━━━━━━━━━━━━━━━━━ 首部 procedure AppendStr(var Dest: string; const S: string); deprecated; $[SysUtils.pas 功能 在字符串Dest後追加字符串S 說明 相當於Dest := Dest + S;Delphi6已經不建議使用 參考 例子 ////////Begin AppendStr procedure TForm1.Button1Click(Sender: TObject); var S: string; begin S := Edit2.Text; AppendStr(S, Edit1.Text); Edit2.Text := S; end; ////////End AppendStr ━━━━━━━━━━━━━━━━━━━━━ 首部 function UpperCase(const S: string): string; $[SysUtils.pas 功能 返回字符串S的大寫形式 說明 非小寫字符不處理 參考 procedure System.SetLength 例子 Edit2.Text := UpperCase(Edit1.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function LowerCase(const S: string): string; $[SysUtils.pas 功能 返回字符串S的小寫形式 說明 非大寫字符不處理 參考 procedure System.SetLength 例子 Edit2.Text := LowerCase(Edit1.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function CompareStr(const S1, S2: string): Integer; $[SysUtils.pas 功能 返回比較兩個字符 說明 當S1>S2返回值>0;當S1 例子 SpinEdit1.Value := CompareStr(Edit1.Text, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function CompareMem(P1, P2: Pointer; Length: Integer): Boolean; assembler; $[SysUtils.pas 功能 返回比較兩個內存指針 說明 CompareMem(PChar('12a'), PChar('12c'), 2)=True;CompareMem(PChar('12a'), PChar('12c'), 3)=False 參考 例子 CheckBox1.Checked := CompareMem(Self, Form1, 8); ━━━━━━━━━━━━━━━━━━━━━ 首部 function CompareText(const S1, S2: string): Integer; $[SysUtils.pas 功能 返回比較兩個字符串 說明 不區分大小寫 參考 例子 SpinEdit1.Value := CompareText(Edit1.Text, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function SameText(const S1, S2: string): Boolean; $[SysUtils.pas 功能 返回兩個字符串是否相等 說明 不區分大小寫 參考 例子 CheckBox1.Checked := SameText(Edit1.Text, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiUpperCase(const S: string): string; $[SysUtils.pas 功能 返回字符串S的大寫形式 說明 ANSI(American National Standards Institute)美國國家標準協會;非小寫的字符不變 參考 function Windows.CharUpperBuff 例子 Edit2.Text := AnsiUpperCase(Edit1.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiLowerCase(const S: string): string; $[SysUtils.pas 功能 返回字符串S的小寫形式 說明 非大寫字符不處理 參考 function Windows.CharLowerBuff 例子 Edit2.Text := AnsiLowerCase(Edit1.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiCompareStr(const S1, S2: string): Integer; $[SysUtils.pas 功能 反回比較兩個字符串 說明 當S1>S2返回值>0;當S1S2返回值>0;當S1S2返回值>0;當S1S2返回值>0;當S1S2返回值>0;當S1S2返回值>0;當S1S2返回值>0;當S1S2返回值>0;當S1 ━━━━━━━━━━━━━━━━━━━━━ 首部 function IsValidIdent(const Ident: string): Boolean; $[SysUtils.pas 功能 返回字符串Ident是否是正確的標識符 說明 標識符::字母|下劃線[字母|下劃線|數字]... 參考 例子 CheckBox1.Checked := IsValidIdent(Edit1.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function IntToStr(Value: Integer): string; overload; $[SysUtils.pas 首部 function IntToStr(Value: Int64): string; overload; $[SysUtils.pas 功能 返回整數Value轉換成字符串 說明 Format('%d', [Value]) 參考 function SysUtils.FmtStr 例子 Edit2.Text := IntToStr(SpinEdit1.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function IntToHex(Value: Integer; Digits: Integer): string; overload; $[SysUtils.pas 首部 function IntToHex(Value: Int64; Digits: Integer): string; overload; $[SysUtils.pas 功能 返回整數Value轉換成十六進制表現結果;Format('%.*x', [Digits, Value]) 說明 參數Digits指定字符最小寬度;最小寬度不足時將用0填充 參考 function SysUtils.FmtStr 例子 Edit2.Text := IntToHex(SpinEdit1.Value, SpinEdit2.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToInt(const S: string): Integer; $[SysUtils.pas 功能 返回字符串S轉換成整數 說明 字符串非整數表達時將引起異常 參考 procedure System.Val 例子 SpinEdit1.Value := StrToInt(Edit1.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToIntDef(const S: string; Default: Integer): Integer; $[SysUtils.pas 功能 返回字符串S轉換成整數 說明 字符串非整數表達時則返回默認值Default 參考 procedure System.Val 例子 SpinEdit1.Value := StrToIntDef(Edit1.Text, 0); ━━━━━━━━━━━━━━━━━━━━━ 首部 function TryStrToInt(const S: string; out Value: Integer): Boolean; $[SysUtils.pas 功能 返回字符串S轉換成整數Value是否成功 說明 字符串非整數表達時返回False並且Value將輸出爲0 參考 procedure System.Val 例子 ///////Begin TryStrToInt procedure TForm1.Button1Click(Sender: TObject); var I: Integer; begin CheckBox1.Checked := TryStrToInt(Edit1.Text, I); SpinEdit1.Value := I; end; ///////End TryStrToInt ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToInt64(const S: string): Int64; $[SysUtils.pas 功能 返回字符串S轉換成六十四位整數 說明 字符串非六十四位整數表達時將引起異常 參考 procedure System.Val 例子 SpinEdit1.Value := StrToInt64(Edit1.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToInt64Def(const S: string; const Default: Int64): Int64; $[SysUtils.pas 功能 返回字符串S轉換成六十四位整數 說明 字符串非六十四位整數表達時則返回默認值Default 參考 procedure System.Val 例子 SpinEdit1.Value := StrToInt64Def(Edit1.Text, 0); ━━━━━━━━━━━━━━━━━━━━━ 首部 function TryStrToInt64(const S: string; out Value: Int64): Boolean; $[SysUtils.pas 功能 返回字符串S轉換成六十四位整數Value是否成功 說明 字符串非六十四位整數表達時返回False並且Value將輸出爲0 參考 procedure System.Val 例子 ///////Begin TryStrToInt64 procedure TForm1.Button1Click(Sender: TObject); var I: Int64; begin CheckBox1.Checked := TryStrToInt64(Edit1.Text, I); SpinEdit1.Value := I; end; ///////End TryStrToInt64 ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToBool(const S: string): Boolean; $[SysUtils.pas 功能 返回字符串S轉換成邏輯值 說明 字符非邏輯表達時將引起異常 參考 function SysUtils.TryStrToBool 例子 CheckBox1.Checked := StrToBool(Edit1.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToBoolDef(const S: string; const Default: Boolean): Boolean; $[SysUtils.pas 功能 返回字符串S轉換成邏輯值 說明 字符非邏輯表達時則返回默認值Default 參考 function SysUtils.TryStrToBool 例子 CheckBox1.Checked := StrToBoolDef(Edit1.Text, False); ━━━━━━━━━━━━━━━━━━━━━ 首部 function TryStrToBool(const S: string; out Value: Boolean): Boolean; $[SysUtils.pas 功能 返回字符串S轉換成邏輯值Value是否成功 說明 [注意]0爲假非0爲真;不是'True'和'False';Delphi6 Bug 如下修正 參考 function SysUtils.AnsiSameText;var SysUtils.TrueBoolStrs;var SysUtils.FalseBoolStrs 例子 ///////Begin TryStrToBool procedure TForm1.Button1Click(Sender: TObject); var B: Boolean; begin SetLength(TrueBoolStrs, 2); SetLength(FalseBoolStrs, 2); TrueBoolStrs[0] := 'True'; FalseBoolStrs[0] := 'False'; TrueBoolStrs[1] := 'Yes'; FalseBoolStrs[1] := 'No'; CheckBox1.Checked := TryStrToBool(Edit1.Text, B); CheckBox2.Checked := B; end; ///////End TryStrToBool 附加 ///////Begin TryStrToBool function TryStrToBool(const S: string; out Value: Boolean): Boolean; function CompareWith(const aArray: array of string): Boolean; var I: Integer; begin Result := False; for I := Low(aArray) to High(aArray) do if AnsiSameText(S, aArray[I]) then begin Result := True; Break; end; end; var LResult: Extended; begin Result := TryStrToFloat(S, LResult); if Result then Value := LResult <> 0 else begin Result := True; //修正處 VerifyBoolStrArray; if CompareWith(TrueBoolStrs) then Value := True else if CompareWith(FalseBoolStrs) then Value := False else Result := False; end; end; ///////End TryStrToBool ━━━━━━━━━━━━━━━━━━━━━ 首部 function BoolToStr(B: Boolean; UseBoolStrs: Boolean = False): string; $[SysUtils.pas 功能 返回邏輯值B轉換成字符串 說明 BoolToStr(False, False)='0';BoolToStr(False, True)='-1' 參考 var SysUtils.TrueBoolStrs;var SysUtils.FalseBoolStrs 例子 Edit1.Text := BoolToStr(CheckBox1.Checked, CheckBox2.Checked); ━━━━━━━━━━━━━━━━━━━━━ 首部 function LoadStr(Ident: Integer): string; $[SysUtils.pas 功能 返回根據標識Ident的字符串資源 說明 字符串資源是指程序的內部資源 參考 function SysUtils.FindStringResource 例子 Edit2.Text := LoadStr(StrToIntDef(Edit1.Text, 0)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function FmtLoadStr(Ident: Integer; const Args: array of const): string; $[SysUtils.pas 功能 返回格式化的字符串資源 說明 字符串資源是指程序的內部資源 參考 function SysUtils.FmtStr;function SysUtils.FindStringResource 例子 ; ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrLen(const Str: PChar): Cardinal; $[SysUtils.pas 功能 返回指針字符串的長度 說明 當指針字符串Str爲nil時將觸發異常 參考 例子 SpinEdit2.Value := StrLen(PChar(Edit1.Text)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrEnd(const Str: PChar): PChar; $[SysUtils.pas 功能 返回指針字符串的結尾 說明 當指針字符串Str爲nil時將觸發異常 參考 例子 Edit2.Text := StrEnd(PChar(Edit1.Text)) - SpinEdit1.Value; ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrMove(Dest: PChar; const Source: PChar; Count: Cardinal): PChar; $[SysUtils.pas 功能 返回將指針字符串Source指定內存數量Count複製覆蓋到指針字符串Dest中 說明 Dest沒有分配資源將觸發異常s 參考 function System.Move 例子 ///////Begin StrMove procedure TForm1.Button1Click(Sender: TObject); var vBuffer: PChar; begin vBuffer := '0123456789'; StrMove(vBuffer, PChar(Edit1.Text), SpinEdit1.Value); Edit2.Text := vBuffer; end; ///////End StrMove ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrCopy(Dest: PChar; const Source: PChar): PChar; $[SysUtils.pas 功能 返回將指針字符串Source複製到指針字符串Dest中 說明 Dest應已經分配足夠的空間非則將觸發異常 參考 例子 ///////Begin StrCopy procedure TForm1.Button1Click(Sender: TObject); var vBuffer: PChar; begin GetMem(vBuffer, Length(Edit1.Text) + 1); StrCopy(vBuffer, PChar(Edit1.Text)); Edit2.Text := vBuffer; FreeMem(vBuffer); end; ///////End StrCopy ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrECopy(Dest:PChar; const Source: PChar): PChar; $[SysUtils.pas 功能 返回將指針字符串Source複製到指針字符串Dest中的結尾 說明 可以連接指針字符串 參考 例子 ///////Begin StrECopy procedure TForm1.Button1Click(Sender: TObject); var vBuffer: array[0..255] of Char; begin StrECopy(StrECopy(vBuffer, PChar(Edit1.Text)), PChar(Edit2.Text)); Edit3.Text := vBuffer; end; ///////End StrECopy ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrLCopy(Dest: PChar; const Source: PChar; MaxLen: Cardinal): PChar; $[SysUtils.pas 功能 返回將指針字符串Source指定長度MaxLen複製到指針字符串Dest中 說明 Dest應已經分配足夠的空間非則將觸發異常 參考 例子 ///////Begin StrLCopy procedure TForm1.Button1Click(Sender: TObject); var vBuffer: array[0..255] of Char; begin StrLCopy(vBuffer, PChar(Edit1.Text), SpinEdit1.Value); Edit2.Text := vBuffer; end; ///////End StrLCopy ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrPCopy(Dest: PChar; const Source: string): PChar; $[SysUtils.pas 功能 返回將指針字符串Source複製到指針字符串Dest中 說明 StrLCopy(Dest, PChar(Source), Length(Source)) 參考 function SysUtils.StrLCopy 例子 ///////Begin StrPCopy procedure TForm1.Button1Click(Sender: TObject); var vBuffer: array[0..255] of Char; begin StrPCopy(vBuffer, PChar(Edit1.Text)); Edit2.Text := vBuffer; end; ///////End StrPCopy ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrPLCopy(Dest: PChar; const Source: string; MaxLen: Cardinal): PChar; $[SysUtils.pas 功能 返回將字符串Source指定長度MaxLen複製到指針字符串Dest中 說明 StrLCopy(Dest, PChar(Source), MaxLen) 參考 function SysUtils.StrLCopy 例子 ///////Begin StrPLCopy procedure TForm1.Button1Click(Sender: TObject); var vBuffer: array[0..255] of Char; begin StrPLCopy(vBuffer, Edit1.Text, SpinEdit1.Value); Edit2.Text := vBuffer; end; ///////End StrPLCopy ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrCat(Dest: PChar; const Source: PChar): PChar; $[SysUtils.pas 功能 返回連接指針字符串Dest和指針字符串Source 說明 StrCopy(StrEnd(Dest), Source) 參考 function SysUntils.StrCopy 例子 ///////Begin StrCat procedure TForm1.Button1Click(Sender: TObject); var vBuffer: array[0..255] of Char; begin StrPCopy(vBuffer, Edit1.Text); StrCat(vBuffer, PChar(Edit2.Text)); Edit3.Text := vBuffer; end; ///////End StrCat ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrLCat(Dest: PChar; const Source: PChar; MaxLen: Cardinal): PChar; $[SysUtils.pas 功能 返回連接指針字符串Dest和指針字符串Source 說明 [注意]MaxLen指定連接後的最大長度不是指針字符串Source的長度 參考 例子 ///////Begin StrLCat procedure TForm1.Button1Click(Sender: TObject); var vBuffer: array[0..255] of Char; begin StrPCopy(vBuffer, Edit1.Text); StrLCat(vBuffer, PChar(Edit2.Text), SpinEdit1.Value); Edit3.Text := vBuffer; end; ///////End StrLCat ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrComp(const Str1, Str2: PChar): Integer; $[SysUtils.pas 功能 返回比較兩個指針字符串 說明 當S1>S2返回值>0;當S1 例子 SpinEdit1.Value := StrComp(PChar(Edit1.Text), PChar(Edit2.Text)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrIComp(const Str1, Str2: PChar): Integer; $[SysUtils.pas 功能 返回比較兩個指針字符串 說明 當S1>S2返回值>0;當S1 例子 SpinEdit1.Value := StrIComp(PChar(Edit1.Text), PChar(Edit2.Text)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrLComp(const Str1, Str2: PChar; MaxLen: Cardinal): Integer; $[SysUtils.pas 功能 返回比較兩個指針字符串指定長度 說明 當S1>S2返回值>0;當S1 例子 SpinEdit1.Value := StrLComp(PChar(Edit1.Text), PChar(Edit2.Text), SpinEdit2.Value) ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrLIComp(const Str1, Str2: PChar; MaxLen: Cardinal): Integer; $[SysUtils.pas 功能 返回比較兩個指針字符串指定長度 說明 當S1>S2返回值>0;當S1 例子 SpinEdit1.Value := StrLIComp(PChar(Edit1.Text), PChar(Edit2.Text), SpinEdit2.Value) ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrScan(const Str: PChar; Chr: Char): PChar; $[SysUtils.pas 功能 返回在指針字符串Str搜索字符Chr第一個出現的地址 說明 沒有找到則返回空指針 參考 例子 Edit2.Text := StrScan(PChar(Edit1.Text), '*'); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrRScan(const Str: PChar; Chr: Char): PChar; $[SysUtils.pas 功能 返回在指針字符串Str搜索字符Chr最後一個出現的地址 說明 沒有找到則返回空指針 參考 例子 Edit2.Text := StrRScan(PChar(Edit1.Text), '*'); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrPos(const Str1, Str2: PChar): PChar; $[SysUtils.pas 功能 返回指針字符串Str2在Str1中第一個出現的地址 說明 沒有找到則返回空指針;StrPos('12345', '3') = '345' 參考 例子 Edit3.Text := StrPos(PChar(Edit1.Text), PChar(Edit2.Text)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrUpper(Str: PChar): PChar; $[SysUtils.pas 功能 返回指針字符串Str大寫 說明 非小寫字符不處理 參考 例子 Edit1.Text := StrUpper(PChar(Edit2.Text)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrLower(Str: PChar): PChar; $[SysUtils.pas 功能 返回指針字符串Str小寫 說明 非大寫字符不處理 參考 例子 Edit1.Text := StrLower(PChar(Edit2.Text)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrPas(const Str: PChar): string; $[SysUtils.pas 功能 返回指針字符串Str轉換成字符串 說明 也可以直接賦值 參考 例子 Edit1.Text := StrPas(PChar(Edit2.Text)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrAlloc(Size: Cardinal): PChar; $[SysUtils.pas 功能 返回分配指定空間的內存資源給指針字符串 說明 空間的大小也將保存;用StrDispose才能全部釋放 參考 function System.GetMem 例子 ///////Begin StrAlloc procedure TForm1.Button1Click(Sender: TObject); var P: PChar; begin P := StrAlloc(SpinEdit1.Value); ShowMessage(IntToStr(StrLen(P))); Dec(P, SizeOf(Cardinal)); ShowMessage(IntToStr(Cardinal(Pointer(P)^))); Inc(P, SizeOf(Cardinal)); StrDispose(P); end; ///////End StrAlloc ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrBufSize(const Str: PChar): Cardinal; $[SysUtils.pas 功能 返回通過函數StrAlloc分配的緩衝區大小 說明 出現異常情況則返回不可預知的結果 參考 function System.SizeOf 例子 SpinEdit1.Value := StrBufSize(StrAlloc(SpinEdit2.Value)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrNew(const Str: PChar): PChar; $[SysUtils.pas 功能 返回複製一個新的指針字符串 說明 如果Str爲nil則返回nil 參考 function SysUtils.StrLen;function SysUtils.StrMove;function SysUtils.StrAlloc 例子 ///////Begin StrNew,StrDispose procedure TForm1.Button1Click(Sender: TObject); var P: PChar; begin P := StrNew(PChar(Edit1.Text)); ShowMessage(P); StrDispose(P); end; ///////End StrNew,StrDispose ━━━━━━━━━━━━━━━━━━━━━ 首部 procedure StrDispose(Str: PChar); $[SysUtils.pas 功能 釋放指針字符串Str內存資源 說明 如果Str爲nil則不作任何處理;並且釋放空間大小信息 參考 function System.Dec;function System.SizeOf;function System.FreeMem 例子 <參見StrNew> ━━━━━━━━━━━━━━━━━━━━━ 首部 function Format(const Format: string; const Args: array of const): string; $[SysUtils.pas 功能 返回按指定方式格式化一個數組常量的字符形式 說明 這個函數是我在Delphi中用得最多的函數,現在就列舉幾個例子給你個直觀的理解 "%" [索引 ":"] ["-"] [寬度] ["." 摘要] 類型 Format('x=%d', [12]); //'x=12' //最普通 Format('x=%3d', [12]); //'x= 12' //指定寬度 Format('x=%f', [12.0]); //'x=12.00' //浮點數 Format('x=%.3f', [12.0]); //'x=12.000' //指定小數 Format('x=%.*f', [5, 12.0]); //'x=12.00000' //動態配置 Format('x=%.5d', [12]); //'x=00012' //前面補充0 Format('x=%.5x', [12]); //'x=0000C' //十六進制 Format('x=%1:d%0:d', [12, 13]); //'x=1312' //使用索引 Format('x=%p', [nil]); //'x=00000000' //指針 Format('x=%1.1e', [12.0]); //'x=1.2E+001' //科學記數法 Format('x=%%', []); //'x=%' //得到"%" S := Format('%s%d', [S, I]); //S := S + StrToInt(I); //連接字符串 參考 proceduer SysUtils.FmtStr 例子 Edit1.Text := Format(Edit2.Text, [StrToFloatDef(Edit.3.Text, 0)]); ━━━━━━━━━━━━━━━━━━━━━ 首部 procedure FmtStr(var Result: string; const Format: string; const Args: array of const); $[SysUtils.pas 功能 按指定方式格式化一個數組常量的字符形式返回 說明 <參見Format> 參考 function SysUtils.FormatBuf;function System.Length;function System.SetLength 例子 <參見Format> ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrFmt(Buffer, Format: PChar; const Args: array of const): PChar; $[SysUtils.pas 功能 返回按指定方式格式化一個數組常量的字符指針形式 說明 如果Buffer和Format其中只要有一個爲nil則返回nil 參考 function SysUtils.FormatBuf 例子 <參見Format> ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrLFmt(Buffer: PChar; MaxBufLen: Cardinal; Format: PChar; const Args: array of const): PChar; $[SysUtils.pas 功能 返回按指定方式和長度格式化一個數組常量的字符指針形式 說明 StrLFmt(vBuffer, 6, '%d|12345', [1024]) = '1024|1'; 參考 function SysUtils.FormatBuf 例子 <參見Format> ━━━━━━━━━━━━━━━━━━━━━ 首部 function FormatBuf(var Buffer; BufLen: Cardinal; const Format; FmtLen: Cardinal; const Args: array of const): Cardinal; $[SysUtils.pas 功能 返回按指定方式格式化一個數組常量到緩衝區Buffer中 說明 參考 例子 <參見Format> ━━━━━━━━━━━━━━━━━━━━━ 首部 function WideFormat(const Format: WideString; const Args: array of const): WideString; $[SysUtils.pas 功能 返回按指定方式格式化一個數組常量的多字節字符形式 說明 參考 procedure SysUtils.WideFmtStr 例子 <參見Format> ━━━━━━━━━━━━━━━━━━━━━ 首部 procedure WideFmtStr(var Result: WideString; const Format: WideString; const Args: array of const); $[SysUtils.pas 功能 按指定方式格式化一個數組常量的多字節字符形式返回 說明 參考 function SysUtils.WideFormatBuf 例子 <參見Format> ━━━━━━━━━━━━━━━━━━━━━ 首部 function WideFormatBuf(var Buffer; BufLen: Cardinal; const Format; FmtLen: Cardinal; const Args: array of const): Cardinal; $[SysUtils.pas 功能 返回按指定方式格式化一個數組常量到緩衝區Buffer中 說明 參考 例子 <參見Format> ━━━━━━━━━━━━━━━━━━━━━ 首部 function FloatToStr(Value: Extended): string; $[SysUtils.pas 功能 返回浮點數Value轉換成字符串 說明 當浮點數大等於1E15將採用科學記數法 參考 function SysUtils.FloatToText 例子 Edit1.Text := FloatToStr(Now); ━━━━━━━━━━━━━━━━━━━━━ 首部 function CurrToStr(Value: Currency): string; $[SysUtils.pas 功能 返回貨幣數Value轉換成字符串 說明 貨幣數只保留四位小數 參考 function SysUtils.FloatToText 例子 Edit1.Text := CurrToStr(Now); ━━━━━━━━━━━━━━━━━━━━━ 首部 function FloatToCurr(const Value: Extended): Currency; $[SysUtils.pas 功能 返回浮點數Value轉換成貨幣數 說明 如果浮點數Value超出範圍則將觸發異常 參考 const SysUtiles.MinCurrency;const SysUtiles.MaxCurrency 例子 Edit1.Text := CurrToStr(FloatToCurr(Now)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function FloatToStrF(Value: Extended; Format: TFloatFormat; Precision, Digits: Integer): string; $[SysUtils.pas 功能 返回浮點數以指定格式轉換成字符串 說明 Precision指定精度;Digits指定小數寬度 參考 function SysUtils.FloatToText 例子 ///////Begin FloatToStrF procedure TForm1.Button1Click(Sender: TObject); begin Memo1.Lines.Values['ffGeneral'] := FloatToStrF(StrToFloatDef(Edit1.Text, 0), ffGeneral, SpinEdit1.Value, SpinEdit2.Value); Memo1.Lines.Values['ffExponent'] := FloatToStrF(StrToFloatDef(Edit1.Text, 0), ffExponent, SpinEdit1.Value, SpinEdit2.Value); Memo1.Lines.Values['ffFixed'] := FloatToStrF(StrToFloatDef(Edit1.Text, 0), ffFixed, SpinEdit1.Value, SpinEdit2.Value); Memo1.Lines.Values['ffNumber'] := FloatToStrF(StrToFloatDef(Edit1.Text, 0), ffNumber, SpinEdit1.Value, SpinEdit2.Value); Memo1.Lines.Values['ffCurrency'] := FloatToStrF(StrToFloatDef(Edit1.Text, 0), ffCurrency, SpinEdit1.Value, SpinEdit2.Value); end; ///////End FloatToStrF ━━━━━━━━━━━━━━━━━━━━━ 首部 function CurrToStrF(Value: Currency; Format: TFloatFormat; Digits: Integer): string; $[SysUtils.pas 功能 返回貨幣類型以指定格式轉換成字符串 說明 Digits指定小數寬度 參考 function SysUtils.FloatToText 例子 ///////Begin CurrToStrF procedure TForm1.Button1Click(Sender: TObject); begin Memo1.Lines.Values['ffGeneral'] := CurrToStrF(StrToCurrDef(Edit1.Text, 0), ffGeneral, SpinEdit1.Value); Memo1.Lines.Values['ffExponent'] := CurrToStrF(StrToCurrDef(Edit1.Text, 0), ffExponent, SpinEdit1.Value); Memo1.Lines.Values['ffFixed'] := CurrToStrF(StrToCurrDef(Edit1.Text, 0), ffFixed, SpinEdit1.Value); Memo1.Lines.Values['ffNumber'] := CurrToStrF(StrToCurrDef(Edit1.Text, 0), ffNumber, SpinEdit1.Value); Memo1.Lines.Values['ffCurrency'] := CurrToStrF(StrToCurrDef(Edit1.Text, 0), ffCurrency, SpinEdit1.Value); end; ///////End CurrToStrF ━━━━━━━━━━━━━━━━━━━━━ 首部 function FloatToText(BufferArg: PChar; const Value; ValueType: TFloatValue; Format: TFloatFormat; Precision, Digits: Integer): Integer; $[SysUtils.pas 功能 返回浮點數以指定格式轉換成指針字符串的內存大小 說明 Precision指定精度;Digits指定小數寬度 參考 例子 ///////Begin FloatToText procedure TForm1.Button1Click(Sender: TObject); var vBuffer: array[0..255] of Char; E: Extended; begin E := StrToFloatDef(Edit1.Text, 0); SpinEdit3.Value := FloatToText(vBuffer, E, fvExtended, ffNumber, SpinEdit1.Value, SpinEdit2.Value); Edit2.Text := Copy(vBuffer, 1, SpinEdit3.Value); end; ///////End FloatToText( ━━━━━━━━━━━━━━━━━━━━━ 首部 function FormatFloat(const Format: string; Value: Extended): string; $[SysUtils.pas 功能 返回浮點數類型以指定格式字符串Format轉換成字符串 說明 FormatFloat(',.00', 1234567890) = '1,234,567,890.00' 參考 function SysUtils.FloatToTextFmt 例子 Edit1.Text := FormatFloat(Edit2.Text, StrToFloatDef(Edit3.Text, 0)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function FormatCurr(const Format: string; Value: Currency): string; $[SysUtils.pas 功能 返回貨幣類型以指定格式字符串Format轉換成字符串 說明 FormatCurr(',.00', 1234567890) = '1,234,567,890.00' 參考 function SysUtils.FloatToTextFmt 例子 Edit1.Text := FormatCurr(Edit2.Text, StrToCurrDef(Edit3.Text, 0)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function FloatToTextFmt(Buf: PChar; const Value; ValueType: TFloatValue; Format: PChar): Integer; $[SysUtils.pas 功能 返回浮點數以指定格式字符串Format轉換成指針字符串的內存大小 說明 ValueType指定無類型參數Value的類型 參考 例子 ///////Begin FloatToTextFmt procedure TForm1.Button1Click(Sender: TObject); var vBuffer: array[0..255] of Char; E: Extended; begin E := StrToFloatDef(Edit1.Text, 0); SpinEdit1.Value := FloatToTextFmt(vBuffer, E, fvExtended, PChar(Edit2.Text)); Edit3.Text := Copy(vBuffer, 1, SpinEdit1.Value); end; ///////End FloatToTextFmt ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToFloat(const S: string): Extended; $[SysUtils.pas 功能 返回字符串S轉換成浮點數 說明 字符串非浮點數表達時將引起異常 參考 function SysUtils.TextToFloat 例子 var E: Extended; begin E := StrToFloat(Edit1.Text); end; ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToFloatDef(const S: string; const Default: Extended): Extended; $[SysUtils.pas 功能 返回字符串S轉換成浮點數 說明 字符串非浮點數表達時則返回默認值Default 參考 function SysUtils.TextToFloat 例子 var E: Extended; begin E := StrToFloatDef(Edit1.Text, 0); end; ━━━━━━━━━━━━━━━━━━━━━ 首部 function TryStrToFloat(const S: string; out Value: Extended): Boolean; overload; $[SysUtils.pas 首部 function TryStrToFloat(const S: string; out Value: Single): Boolean; overload; $[SysUtils.pas 首部 function TryStrToFloat(const S: string; out Value: Double): Boolean; overload; $[SysUtils.pas 功能 返回字符串S轉換成浮點數Value是否成功 說明 字符串非浮點數表達時返回False並且Value將輸出爲不確定的值 參考 function SysUtils.TextToFloat 例子 ///////Begin TryStrToFloat procedure TForm1.Button1Click(Sender: TObject); var E: Extended; begin CheckBox1.Checked := TryStrToFloat(Edit1.Text, E); Edit2.Text := FormatFloat('', E); end; ///////End TryStrToFloat ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToCurr(const S: string): Currency; $[SysUtils.pas 功能 返回字符串S轉換成貨幣數 說明 字符串非貨幣數表達時將引起異常 參考 function SysUtils.TextToFloat 例子 var C: Currency; begin C := StrToCurr(Edit1.Text); end; ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToCurrDef(const S: string; const Default: Currency): Currency; $[SysUtils.pas 功能 返回字符串S轉換成貨幣數 說明 字符串非貨幣數表達時則返回默認值Default 參考 function SysUtils.TextToFloat 例子 var C: Currency; begin C := StrToCurrDef(Edit1.Text, 0); end; ━━━━━━━━━━━━━━━━━━━━━ 首部 function TryStrToCurr(const S: string; out Value: Currency): Boolean; $[SysUtils.pas 功能 返回字符串S轉換成貨幣數Value是否成功 說明 字符串非貨幣數表達時返回False並且Value將輸出爲不確定的值 參考 function SysUtils.TextToFloat 例子 ///////Begin TryStrToCurr procedure TForm1.Button1Click(Sender: TObject); var C: Currency; begin CheckBox1.Checked := TryStrToCurr(Edit1.Text, C); Edit2.Text := FormatCurr('', C); end; ///////End TryStrToCurr ━━━━━━━━━━━━━━━━━━━━━ 首部 function TextToFloat(Buffer: PChar; var Value; ValueType: TFloatValue): Boolean; $[SysUtils.pas 功能 返回將指針字符串Buffer轉換成無類型變量Value 說明 ValueType指定無類型參數Value的類型 參考 例子 ///////Begin TextToFloat procedure TForm1.Button1Click(Sender: TObject); var E: Extended; begin CheckBox1.Checked := TextToFloat(PChar(Edit1.Text), E, fvExtended); Edit2.Text := FormatFloat('', E); end; ///////End TextToFloat ━━━━━━━━━━━━━━━━━━━━━ 首部 function DateToStr(const DateTime: TDateTime): string; $[SysUtils.pas 功能 返回日期DateTime轉換成字符串 說明 轉換格式由系統變量ShortDateFormat控制 參考 function SysUtils.DateTimeToString;var SysUtils.ShortDateFormat 例子 Edit1.Text := DateToStr(Date); ━━━━━━━━━━━━━━━━━━━━━ 首部 function TimeToStr(const DateTime: TDateTime): string; $[SysUtils.pas 功能 返回時間DateTime轉換成字符串 說明 轉換格式由系統變量LongTimeFormat控制 參考 function SysUtils.DateTimeToString;var SysUtils.LongTimeFormat 例子 Edit1.Text := TimeToStr(Date); ━━━━━━━━━━━━━━━━━━━━━ 首部 function DateTimeToStr(const DateTime: TDateTime): string; $[SysUtils.pas 功能 返回日期時間DateTime轉換成字符串 說明 轉換格式由系統變量ShortDateFormat和LongTimeFormat控制 參考 function SysUtils.DateTimeToString 例子 Edit1.Text := DateTimeToStr(Now); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToDate(const S: string): TDateTime; $[SysUtils.pas 功能 返回字符串S轉換成日期 說明 字符非日期表達時將引起異常 參考 function SysUtils.TryStrToDate 例子 DateTimePicker1.Date := StrToDate(Edit1.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToDateDef(const S: string; const Default: TDateTime): TDateTime; $[SysUtils.pas 功能 返回字符串S轉換成日期 說明 字符非日期表達時則返回默認值Default 參考 function SysUtils.TryStrToDate 例子 DateTimePicker1.Date := StrToDateDef(Edit1.Text, Date); ━━━━━━━━━━━━━━━━━━━━━ 首部 function TryStrToDate(const S: string; out Value: TDateTime): Boolean; $[SysUtils.pas 功能 返回字符串S轉換成日期Value是否成功 說明 字符非日期表達時返回False並且Value將輸出爲0 參考 例子 ///////Begin TryStrToDate procedure TForm1.Button1Click(Sender: TObject); var vDateTime: TDateTime; begin CheckBox1.Checked := TryStrToDate(Edit1.Text, vDateTime); DateTimePicker1.Date := vDateTime; end; ///////End TryStrToDate ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToTime(const S: string): TDateTime; $[SysUtils.pas 功能 返回字符串S轉換成時間 說明 字符非時間表達時將引起異常 參考 function SysUtils.TryStrToTime 例子 DateTimePicker1.Time := StrToTime(Edit1.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToTimeDef(const S: string; const Default: TDateTime): TDateTime; $[SysUtils.pas 功能 返回字符串S轉換成時間 說明 字符非時間表達時則返回默認值Default 參考 function SysUtils.TryStrToTime 例子 DateTimePicker1.Time := StrToTimeDef(Edit1.Text, Time); ━━━━━━━━━━━━━━━━━━━━━ 首部 function TryStrToTime(const S: string; out Value: TDateTime): Boolean; $[SysUtils.pas 功能 返回字符串S轉換成時間Value是否成功 說明 字符非時間表達時返回False並且Value將輸出爲0 參考 例子 ///////Begin TryStrToTime procedure TForm1.Button1Click(Sender: TObject); var vDateTime: TDateTime; begin CheckBox1.Checked := TryStrToTime(Edit1.Text, vDateTime); DateTimePicker1.Time := vDateTime; end; ///////End TryStrToTime ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToDateTime(const S: string): TDateTime; $[SysUtils.pas 功能 返回字符串S轉換成日期時間 說明 字符非日期時間表達時將引起異常 參考 function SysUtils.TryStrToDateTime 例子 Edit1.Text := DateTimeToStr(StrToDateTime(Edit2.Text)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrToDateTimeDef(const S: string; const Default: TDateTime): TDateTime; $[SysUtils.pas 功能 返回字符串S轉換成日期時間 說明 字符非日期時間表達時則返回默認值Default 參考 function SysUtils.TryStrToDateTime 例子 Edit1.Text := DateTimeToStr(StrToDateTimeDef(Edit2.Text, Now)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function TryStrToDateTime(const S: string; out Value: TDateTime): Boolean; $[SysUtils.pas 功能 返回字符串S轉換成日期時間Value是否成功 說明 字符非日期時間表達時返回False並且Value將輸出爲0 參考 例子 ///////Begin TryStrToDateTime procedure TForm1.Button1Click(Sender: TObject); var vDateTime: TDateTime; begin CheckBox1.Checked := TryStrToDateTime(Edit1.Text, vDateTime); Edit2.Text := DateTimeToStr(vDateTime); end; ///////End TryStrToDateTime ━━━━━━━━━━━━━━━━━━━━━ 首部 procedure DateTimeToString(var Result: string; const Format: string; DateTime: TDateTime); $[SysUtils.pas 功能 用指定的格式Format來格式化日期時間DateTime並返回到字符串Result中 說明 <參見FormatDateTime> 參考 function System.SetString 例子 <參見FormatDateTime> ━━━━━━━━━━━━━━━━━━━━━ 首部 function GetLocaleStr(Locale, LocaleType: Integer; const Default: string): string; platform; $[SysUtils.pas 功能 返回當前系統指定參數的字符串值 說明 GetLocaleStr(GetThreadLocale, LOCALE_SLANGUAGE, '') = '中文(中國)' 參考 function Windows.GetLocaleInfo 例子 Edit1.Text := GetLocaleStr(GetThreadLocale, SpinEdit1.Value, ''); ━━━━━━━━━━━━━━━━━━━━━ 首部 function GetLocaleChar(Locale, LocaleType: Integer; Default: Char): Char; platform; $[SysUtils.pas 功能 返回當前系統指定參數的字符值 說明 GetLocaleChar(GetThreadLocale, LOCALE_STHOUSAND, #0) = ',' 參考 function Windows.GetLocaleInfo 例子 Edit1.Text := GetLocaleChar(GetThreadLocale, LOCALE_SLANGUAGE, #0); ━━━━━━━━━━━━━━━━━━━━━ 首部 function ByteType(const S: string; Index: Integer): TMbcsByteType; $[SysUtils.pas 功能 返回字符串S位置Index上的字符在MBCS中類型 說明 多字節字符系統:Multi-Byte Character System (MBCS) 參考 var SysUtils.SysLocale 例子 SpinEdit1.Value := Ord(ByteType(Edit1.Text, SpinEdit2.Value)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrByteType(Str: PChar; Index: Cardinal): TMbcsByteType; $[SysUtils.pas 功能 返回指針字符串Str位置Index上的字符在MBCS中類型 說明 Index從0開始 參考 var SysUtils.SysLocale 例子 SpinEdit1.Value := Ord(StrByteType(PChar(Edit1.Text), SpinEdit2.Value)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function ByteToCharLen(const S: string; MaxLen: Integer): Integer; $[SysUtils.pas 功能 返回字符串S中有多少個多字節字符 說明 MaxLen指定處理字符個數 參考 function SysUtils.ByteToCharIndex 例子 SpinEdit1.Value := ByteToCharLen(Edit1.Text, SpinEdit2.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function CharToByteLen(const S: string; MaxLen: Integer): Integer; $[SysUtils.pas 功能 返回字符串S中有多少個字符 說明 MaxLen指定處理多字節字符個數 參考 var SysUtils.SysLocale 例子 SpinEdit1.Value := CharToByteLen(Edit1.Text, SpinEdit2.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function ByteToCharIndex(const S: string; Index: Integer): Integer; $[SysUtils.pas 功能 返回字符位置對應的多字節字符位置 說明 ByteToCharIndex('你好', 2) = 1;ByteToCharIndex('你好', 3) = 2 參考 function SysUtils.NextCharIndex 例子 SpinEdit1.Value := ByteToCharIndex(Edit1.Text, SpinEdit2.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function CharToByteIndex(const S: string; Index: Integer): Integer; $[SysUtils.pas 功能 返回多字節字符位置對應的字符起始位置 說明 CharToByteIndex('你好', 1) = 1;CharToByteIndex('你好', 2) = 3 參考 function System.Length 例子 SpinEdit1.Value := CharToByteIndex(Edit1.Text, SpinEdit2.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrCharLength(const Str: PChar): Integer; $[SysUtils.pas 功能 返回第一個字符的寬度 說明 參數爲空則返回0 參考 function Windows.CharNext 例子 SpinEdit1.Value := StrCharLength(PChar(Edit1.Text)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function StrNextChar(const Str: PChar): PChar; $[SysUtils.pas 功能 返回字符指針Str的下一個字符指針 說明 StrNextChar('1234') = '234'; 參考 function Windows.CharNext 例子 Edit2.Text := StrNextChar(PChar(Edit1.Text)); ━━━━━━━━━━━━━━━━━━━━━ 首部 function CharLength(const S: String; Index: Integer): Integer; $[SysUtils.pas 功能 返回字符串中指定位置的字符寬度 說明 CharLength('English漢', 1) = 1;CharLength('English漢', 8) = 2 參考 function System.Assert;function SysUtils.StrCharLength 例子 SpinEdit1.Value := CharLength(Edit1.Text, SpinEdit2.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function NextCharIndex(const S: String; Index: Integer): Integer; $[SysUtils.pas 功能 返回下一個字符的位置 說明 CharLength('你好', 1) = 3;CharLength('你好', 3) = 5 參考 function System.Assert;function SysUtils.StrCharLength 例子 SpinEdit1.Value := NextCharIndex(Edit1.Text, SpinEdit2.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function IsPathDelimiter(const S: string; Index: Integer): Boolean; $[SysUtils.pas 功能 返回字符串S中指定位置Index上是否是一個路徑分隔符 說明 IsPathDelimiter('C:/Windows', 3) = True 參考 const SysUtils.PathDelim;function SysUtils.ByteType 例子 CheckBox1.Checked := IsPathDelimiter(Edit1.Text, SpinEdit1.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function IsDelimiter(const Delimiters, S: string; Index: Integer): Boolean; $[SysUtils.pas 功能 返回字符串S中指定位置Index上是否是一個分隔符Delimiters 說明 IsDelimiter('@', '[email protected]', 8) = True 參考 function SysUtils.ByteType 例子 CheckBox1.Checked := IsDelimiter(Edit1.Text, Edit2.Text, SpinEdit1.Value); ━━━━━━━━━━━━━━━━━━━━━ 首部 function IncludeTrailingPathDelimiter(const S: string): string; $[SysUtils.pas 功能 返回包括最後路徑分隔符 說明 最後一個字符是路徑分隔符則不變;否則加上一個路徑分隔符返回 參考 function SysUtils.IsPathDelimiter;function System.Length 例子 Edit1.Text := IncludeTrailingPathDelimiter(Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function IncludeTrailingBackslash(const S: string): string; platform; $[SysUtils.pas 功能 返回包括最後斜線 說明 Result := IncludeTrailingPathDelimiter(S); 參考 function SysUtils.IncludeTrailingPathDelimiter 例子 Edit1.Text := IncludeTrailingBackslash(Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function ExcludeTrailingPathDelimiter(const S: string): string; $[SysUtils.pas 功能 返回排除最後路徑分隔符 說明 最後一個字符不是路徑分隔符則不變;否則減去最後的路徑分隔符返回 參考 function SysUtils.IsPathDelimiter;function System.Length;function System.SetLength 例子 Edit1.Text := ExcludeTrailingPathDelimiter(Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function ExcludeTrailingBackslash(const S: string): string; platform; $[SysUtils.pas 功能 返回排除最後斜線 說明 Result := ExcludeTrailingPathDelimiter(S) 參考 function SysUtils.ExcludeTrailingPathDelimiter 例子 Edit1.Text := ExcludeTrailingBackslash(Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function LastDelimiter(const Delimiters, S: string): Integer; $[SysUtils.pas 功能 返回最後一個分隔符的位置 說明 LastDelimiter('.', 'kingron.myetang.com') = 16 參考 function SysUtils.StrScan;function SysUtils.ByteType 例子 SpinEdit1.Value := LastDelimiter(Edit1.Text, Edit2.Text); ━━━━━━━━━━━━━━━━━━━━━ 首部 function AnsiCompareFileName(const S1, S2: string): Integer; $[SysUtils.pas 功能 返回比較兩個文件名 說明 當S1>S2返回值>0;當S1 參考 fuction Windows.Succeeded 例子 Edit2.Text := GUIDToString(StringToGUID(Edit1.Text)); ━━━━━━━━━━━━━━━━━━━━━ Delphi函數手冊 abort 函數 引起放棄的意外處理 abs 函數 絕對值函數 addexitproc 函數 將一過程添加到運行時庫的結束過程表中 addr 函數 返回指定對象的地址 adjustlinebreaks 函數 將給定字符串的行分隔符調整爲cr/lf序列 align 屬性 使控件位於窗口某部分 alignment 屬性 控件標籤的文字位置 allocmem 函數 在堆棧上分配給定大小的塊 allowgrayed 屬性 允許一個灰度選擇 ansicomparestr 函數 比較字符串(區分大小寫) ansicomparetext 函數 比較字符串(不區分大小寫) ansilowercase 函數 將字符轉換爲小寫 ansiuppercase 函數 將字符轉換爲大寫 append 函數 以附加的方式打開已有的文件 arctan 函數 餘切函數 assignfile 函數 給文件變量賦一外部文件名 assigned 函數 測試函數或過程變量是否爲空 autosize 屬性 自動控制標籤的大小 backgrounddi2001.jpg 屬性 背景色 beginthread 函數 以適當的方式建立用於內存管理的線程 bevelinner 屬性 控件方框的內框方式 bevelouter 屬性 控件方框的外框方式 bevelwidth 屬性 控件方框的外框寬度 blockread 函數 讀一個或多個記錄到變量中 blockwrite 函數 從變量中寫一個或多個記錄 borderstyle 屬性 邊界類型 borderwidth 屬性 邊界寬度 break 命令 終止for、while、repeat循環語句 brush 屬性 畫刷 caption 屬性 標籤文字的內容 changefileext 函數 改變文件的後綴 chdir 函數 改變當前目錄 checked 屬性 確定複選框選中狀態 chr 函數 返回指定序數的字符 closefile 命令 關閉打開的文件 color 屬性 標籤的顏色 columns 屬性 顯示的列數 comparestr 函數 比較字符串(區分大小寫) concat 函數 合併字符串 continue 命令 繼續for、while、repeat的下一個循環 copy 函數 返回一字符串的子串 cos 函數 餘弦函數 ctl3d 屬性 是否具有3d效果 cursor 屬性 鼠標指針移入後的形狀 date 函數 返回當前的日期 datetimetofiledate 函數 將delphi的日期格式轉換爲dos的日期格式 datetimetostr 函數 將日期時間格式轉換爲字符串 datetimetostring 函數 將日期時間格式轉換爲字符串 datetostr 函數 將日期格式轉換爲字符串 dayofweek 函數 返回星期的數值 dec 函數 遞減變量值 decodedate 函數 將日期格式分解爲年月日 decodetime 函數 將時間格式分解爲時、分、秒、毫秒 delete 函數 從字符串中刪除子串 deletefile 命令 刪除文件 diskfree 函數 返回剩餘磁盤空間的大小 disksize 函數 返回指定磁盤的容量 dispose 函數 釋放動態變量所佔的空間 disposestr 函數 釋放字符串在堆棧中的內存空間 ditherbackgrounddi2001.jpg?使背景色的色彩加重或減少50% dragcursor 屬性 當鼠標按下時光標的形狀 dragmode 屬性 按動的作用方式 dropdowncount 屬性 容許的顯示數據項的數目 editmask 屬性 編輯模式 enabled 屬性 是否使標籤呈現打開狀態 encodedate 函數 將年月日合成爲日期格式 encodetime 函數 將時、分、秒、毫秒合成爲時間格式 endmargin 屬性 末尾邊緣 eof 函數 對有類型或無類型文件測試是否到文件尾 eoln 函數 返回文本文件的行結束狀態 erase 命令 刪除外部文件 exceptaddr 函數 返回引起當前意外的地址 exclude 函數 從集合中刪除一些元素 exceptobject 函數 返回當前意外的索引 exit 命令 立即從當前的語句塊中退出 exp 函數 指數函數 expandfilename 函數 返回包含絕對路徑的字符串 extendedselect 屬性 是否允許存在選擇模式,true時,multiselect纔有意義 extractfiledir 函數 返回驅動器和路徑 extractfileext 函數 返回文件的後綴 extractfilename 函數 返回文件名 extractfilepath 函數 返回指定文件的路徑 fileage 函數 返回文件已存在的時間 fileclose 命令 關閉指定的文件 filecreate 命令 用指定的文件名建立新文件 filedatetodatetime 函數 將dos的日期格式轉換爲delphi的日期格式 fileexists 函數 檢查文件是否存在 filegatattr 函數 返回文件的屬性 filegetdate 函數 返回文件的dos日期時間標記 fileopen 命令 用指定的存取模式打開指定的文件 filepos 函數 返回文件的當前指針位置 fileread 命令 從指定的文件讀取 filesearch 命令 在目錄中搜索指定的文件 fileseek 函數 改變文件的指針 filesetattr 函數 設置文件屬性 filesetdate 函數 設置文件的dos日期時間標記 filesize 函數 返回當前文件的大小 filewrite 函數 對指定的文件做寫操作 fillchar 函數 用指定的值填充連續字節的數 findclose 命令 終止findfirst/findnext序列 findfirst 命令 對指定的文件名及屬性搜索目錄 findnext 命令 返回與文件名及屬性匹配的下一入口 floattodecimal 函數 將浮點數轉換爲十進制數 floattostrf 函數 將浮點數轉換爲字符串 floattostr 函數 將浮點數轉換爲字符串 floattotext 函數 將給定的浮點數轉換爲十進制數 floattotextfmt 函數 將給定的浮點數轉換爲十進制數 flush 函數 將緩衝區的內容刷新到輸出的文本文件中 fmtloadstr 函數 從程序的資源字符串表中裝載字符串 fmtstr 函數 格式化一系列的參數,其結果以參數result返回 font 屬性 設置字體 format 函數 格式化一系列的參數並返回pascal字符串 formatbuf 函數 格式化一系列的參數 formatdatetime 函數 用指定的格式來格式化日期和時間 formatfloat 函數 指定浮點數格式 frac 函數 返回參數的小數部分 freemem 函數 按給定大小釋放動態變量所佔的空間 getdir 返回指定驅動器的當前目錄 getheapstatus 返回內存管理器的當前狀態 getmem 建立一指定大小的動態變量,並將指針指向該處 getmemorymanager 返回內存管理器的入口點 glyph 函數 按鈕上的圖象 halt 停止程序的執行並返回到操作系統 hi 返回參數的高地址位 high 返回參數的上限值 hint 屬性 提示信息 int 返回參數的整數部分 include 添加元素到集合中 insert 在字符串中插入子串 inttohex 將整型數轉換爲十六進制數 inttostr 將整型數轉換爲字符串 ioresult 返回最新的i/o操作完成狀態 isvalidident 測試字符串是否爲有效的標識符 items 屬性 默認顯示的節點 kind 屬性 擺放樣式 largechange 屬性 最大改變值 layout 屬性 圖象佈局 length 函數 返回字符串的動態長度 lines 屬性 缺省顯示內容 ln 函數 自然對數函數 lo 函數 返回參數的低地址位 loadstr 函數 從應用程序的可執行文件中裝載字符資源 lowercase 函數 將給定的字符串變爲小寫 low 函數 返回參數的下限值 max 屬性 最大值 maxlength 屬性 最大長度 min 屬性 最小值 mkdir 命令 建立一子目錄 move 函數 從源到目標複製字節 multiselect 屬性 允許同時選擇幾個數據項 name 屬性 控件的名字 new 函數 建立新的動態變量並設置一指針變量指向他 newstr 函數 在堆棧上分配新的字符串 now 函數 返回當前的日期和時間 odd 測試參數是否爲奇數 onactivate 事件 焦點移到窗體上時觸發 onclick 事件 單擊窗體空白區域觸發 ondblclick 事件 雙擊窗體空白區域觸發 onclosequery 事件 使用者試圖關閉窗體觸發 onclose 事件 窗體關閉後才觸發 oncreate 事件 窗體第一次創建時觸發 ondeactivate 事件 用戶切換到另一應用程序觸發 ondragdrop 事件 鼠標拖放操作結束時觸發 ondragover 事件 有其他控件從他上面移過觸發 onmousedown 事件 按下鼠標鍵時觸發 onmouseup 事件 釋放鼠標鍵時觸發 onmousemove 事件 移動鼠標時觸發 onhide 事件 隱藏窗體時觸發 onkeydown 事件 按下鍵盤某鍵時觸發 onkeypress 事件 按下鍵盤上的單個字符鍵時觸發 onkeyup 事件 釋放鍵盤上的某鍵時觸發 onpaint 事件 窗體上有新部分暴露出來觸發 onresize 事件 重新調整窗體大小觸發 onshow 事件 在窗體實際顯示之前瞬間觸發 ord 返回序數類的序數 outlinestyle 屬性 類型 outofmemoryerror 引起outofmemory意外 pageindex 屬性 頁索引 pages 屬性 頁 paramcount 函數 返回在命令行上傳遞給程序的參數數量 paramstr 函數 返回指定的命令行參數 pen 屬性 畫刷設置 pi 函數 返回圓周率pi picture 屬性 顯示圖象 pictureclosed 屬性 設置closed位圖 pictureleaf 屬性 設置leaf位圖 pictureminus 屬性 設置minus位圖 pictureopen 屬性 設置open位圖 pictureplus 屬性 設置plus位圖 pos 函數 在字符串中搜索子串 pred 函數 返回先前的參數 random 函數 返回一隨機函數 randomize 函數 用一隨機數初始化內置的隨機數生成器 read 函數 對有格式的文件,讀一文件組件到變量中; 對文本文件,讀一個或多個值到一個或多個變量中 readln 函數 執行read過程,然後跳到文件下一行 readonly 屬性 只讀屬性 reallocmem 函數 分配一動態變量 rename 函數 重命名外部文件 renamefile 函數 對文件重命名 reset 函數 打開已有的文件 rewrite 函數 建立並打開一新的文件 rmdir 函數 刪除空的子目錄 round 函數 將實數值舍入爲整型值 runerror 函數 停止程序的執行 scrollbars 屬性 滾動條狀態 seek 函數 將文件的當前指針移動到指定的組件上 seekeof 函數 返回文件的文件結束狀態 seekeoln 函數 返回文件的行結束狀態 selectedcolor 屬性 選中顏色 setmemorymanager 函數 設置內存管理器的入口點 settextbuf 函數 給文本文件指定i/o緩衝區 shape 屬性 顯示的形狀 showexception 函數 顯示意外消息與地址 sin 函數 正弦函數 sizeof 函數 返回參數所佔的字節數 smallchange 屬性 最小改變值 sorted 屬性 是否允許排序 sqr 函數 平方函數 sqrt 函數 平方根函數 startmargin 屬性 開始邊緣 state 屬性 控件當前狀態 str 函數 將數值轉換爲字符串 stralloc 函數 給以null結束的字符串分配最大長度-1的緩衝區 strbufsize 函數 返回存儲在由stralloc分配的字符緩衝區的最大字符數 strcat 函數 將一字符串附加到另一字符串尾並返回合併的字符串 strcomp 函數 比較兩個字符串 strcopy 函數 將一個字符串複製到另一個字符串中 strdispose 函數 釋放堆棧上的字符串 strecopy 函數 將一字符串複製到另一個字符串並返回結果字符串尾部的指針 strend 函數 返回指向字符串尾部的指針 stretch 屬性 自動適應控件的大小 strfmt 函數 格式化一系列的參數 stricomp 函數 比較兩個字符串(不區分大小寫) stringtowidechar 函數 將ansi字符串轉換爲unicode字符串 strlcat 函數 將一字符串中的字符附加到另一字符串尾並返回合併的字符串 strlcomp 函數 以最大長度比較兩個字符串 strlcopy 函數 將一個字符串中的字符複製到另一個字符串中 strlen 函數 返回字符串中的字符數 strlfmt 函數 格式化一系列的參數,其結果中包含有指向目標緩衝區的指針 strlicomp 函數 以最大長度比較兩個字符串(不區分大小寫) strlower 函數 將字符串中的字符轉換爲小寫 strmove 函數 將一個字符串中的字符複製到另一個字符串中 strnew 函數 在堆棧上分配一個字符串 strpas 函數 將以null結束的字符串轉換爲pascal類的字符串 strpcopy 函數 將pascal類的字符串複製爲以null結束的字符串 strplcopy 函數 從pascal類的最大長度字符串複製爲以null結束的字符串 strpos 函數 返回一個字符串在另一個字符串中首次出現指針 strrscan 函數 返回字符串中最後出現字符的指針 strscan 函數 返回字符串中出現首字符的指針 strtodate 函數 將字符串轉換爲日期格式 strtodatetime 函數 將字符串轉換爲日期/時間格式 strtofloat 函數 將給定的字符串轉換爲浮點數 strtoint 函數 將字符串轉換爲整型 strtointdef 函數 將字符串轉換爲整型或默認值 strtotime 函數 將字符串轉換爲時間格式 strupper 函數 將字符串中的字符轉換爲大寫 style 屬性 類型選擇 suce 函數 返回後繼的參數 swap 函數 交換參數的高低地址位 tabs 屬性 標記每一項的內容 tabindex 屬性 標記索引 text 屬性 顯示的文本 texttofloat 函數 將字符串(以null結束的格式)轉換爲浮點數 time 函數 返回當前的時間 timetostr 函數 將時間格式轉換爲字符串 trim 函數 從給定的字符串中刪除前導和尾部的空格及控制字符 trimleft 函數 從給定的字符串中刪除首部的空格及控制字符 trimright 函數 從給定的字符串中刪除尾部的空格及控制字符 trunc 函數 將實型值截取爲整型值 truncate 函數 截去當前文件位置後的內容 unselectedcolor 屬性 未選中顏色 upcase 將字符轉換爲大寫 uppercase 將給定的字符串變爲大寫 val 函數 將字符串轉換爲整型值 vararraycreate 函數 以給定的界限和維數建立變體數組 vararraydimcount 函數 返回給定變體的維數 vararrayhighbound 函數 返回給定變體數組維數的上界 vararraylock 函數 鎖定給定的變體數組 vararraylowbound 函數 返回給定變體數組維數的下界 vararrayof 函數 返回指定變體的數組元素 vararrayredim 函數 通過改變上限來調整變體的大小 vararrayunlock 函數 解鎖指定的變體數組 varastype 函數 將變體轉換爲指定的類型 varcase 函數 將變體轉換爲指定的類型並保存他 varclear 函數 清除指定的變體 varcopy 函數 將指定的變體複製爲指定的變體 varformdatetime 函數 返回包含日期時間的變體 varisarray 函數 測試變體是否爲數組 varisempty 函數 測試變體是否爲unassigned varisnull 函數 測試變體是否爲null vartodatetime 函數 將給定的變體轉換爲日期時間 vartype 函數 將變體轉換爲指定的類型並保存他 visible 屬性 控件的可見性 wantreturns 屬性 爲true時,按回車鍵產生一個回車符; 爲false時,按下ctrl+enter才產生回車符 write 命令 對有格式的文件,寫一變量到文件組件中; 對文本文件,寫一個或多個值到文件中 writeln 命令 執行write過程,然後輸出一行結束標誌 widecharlentostring 函數 將ansi字符串轉換爲unicode字符串 widecharlentostrwar 函數 將unicode字符串轉換爲ansi字符串變量 widechartostring 函數 將unicode字符串轉換爲ansi字符串 widechartostrvar 函數 將unicode字符串轉換爲ansi字符串變量
發佈了20 篇原創文章 · 獲贊 1 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章