Delphi轉換函式的定義及說明
來源:互聯網
上載者:User
◇[DELPHI]轉換函式的定義及說明
datetimetofiledate (datetime:Tdatetime):longint; 將Tdatetime格式的日期時間值轉換成DOS格式的日期時間值
datetimetostr (datetime:Tdatetime):string; 將Tdatatime格式變數轉換成字串,如果datetime參數不包含日期值,返回字串日期顯示成為00/00/00,如果datetime參數中沒有時間值,返回字串中的時間部分顯示成為00:00:00 AM
datetimetostring (var result string;
const format:string;
datetime:Tdatetime); 根據給定的格式字串轉換時間和日期值,result為結果字串,format為轉換格式字串,datetime為日期時間值
datetostr (date:Tdatetime) 使用shortdateformat全域變數定義的格式字串將date參數轉換成對應的字串
floattodecimal (var result:Tfloatrec;value:
extended;precision,decimals:
integer); 將浮點數轉換成十進位表示
floattostr (value:extended):string 將浮點數value轉換成字串格式,該轉換使用普通數字格式,轉換的有效位元為15位。
floattotext (buffer:pchar;value:extended;
format:Tfloatformat;precision,
digits:integer):integer; 用給定的格式、精度和小數將浮點值value轉換成十進位表示形式,轉換結果存放於buffer參數中,函數傳回值為儲存到buffer中的字元位元,buffer是非0結果的字串緩衝區。
floattotextfmt (buffer:pchar;value:extended;
format:pchar):integer 用給定的格式將浮點值value轉換成十進位表示形式,轉換結果存放於buffer參數中,函數傳回值為儲存到buffer中的字元位元。
inttohex (value:longint;digits:integer):
string; 將給定的數值value轉換成十六進位的字串。參數digits給出轉換結果字串包含的數字位元。
inttostr (value:longint):string 將整數轉換成十進位形式字串
strtodate (const S:string):Tdatetime 將字串轉換成日期值,S必須包含一個合法的格式日期的字串。
strtodatetime (const S:string):Tdatetime 將字串S轉換成日期時間格式,S必須具有MM/DD/YY HH:MM:SS[AM|PM]格式,其中日期和時間分隔字元與系統時期時間常量設定相關。如果沒有指定AM或PM資訊,表示使用24小時制。
strtofloat (const S:string):extended; 將給定的字串轉換成浮點數,字串具有如下格式:
[+|-]nnn…[.]nnn…[<+|-><E|e><+|->nnnn]
strtoint (const S:string):longint 將數字字串轉換成整數,字串可以是十進位或十六進位格式,如果字串不是一個合法的數字字串,系統發生ECONVERTERROR異常
strtointdef (const S:string;default:
longint):longint; 將字串S轉換成數字,如果不能將S轉換成數字,strtointdef函數返回參數default的值。
strtotime (const S:string):Tdatetime 將字串S轉換成TDATETIME值,S具有HH:MM:SS[AM|PM]格式,實際的格式與系統的時間相關的全域變數有關。
timetostr (time:Tdatetime):string; 將參數TIME轉換成字串。轉換結果字串的格式與系統的時間相關常量的設定有關。