<<delphi6 function Daquan 4-sysutils.pas>>
First function formatfloat (const format:string; value:extended): string; $[sysutils.pas
function returns the floating-point number type to convert to a string in the specified format string format
Description Formatfloat (',. 00 ', 1234567890) = ' 1,234,567,890.00 '
Reference function Sysutils.floattotextfmt
Example Edit1.text: = Formatfloat (Edit2.text, Strtofloatdef (edit3.text, 0));
━━━━━━━━━━━━━━━━━━━━━
First function Formatcurr (const format:string; value:currency): string; $[sysutils.pas
Feature return currency type converts to string in specified format string
Description Formatcurr (',. 00 ', 1234567890) = ' 1,234,567,890.00 '
Reference function Sysutils.floattotextfmt
Example Edit1.text: = Formatcurr (Edit2.text, Strtocurrdef (edit3.text, 0));
━━━━━━━━━━━━━━━━━━━━━
First function floattotextfmt (buf:pchar; const Value; Valuetype:tfloatvalue; Format:pchar): Integer; $[sysutils.pas
function returns a floating-point number the amount of memory converted to a pointer string in the specified format string
Description valuetype specifies a type with no type parameter value
Reference <NULL>
Example
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
━━━━━━━━━━━━━━━━━━━━━
Header function Strtofloat (const s:string): Extended; $[sysutils.pas
function return string s to floating-point number
Indicates a string that is not a floating-point number expression that causes an exception
Reference function Sysutils.texttofloat
Example Var e:extended; Begin E: = Strtofloat (Edit1.text); End
━━━━━━━━━━━━━━━━━━━━━
Header function Strtofloatdef (const s:string; const default:extended): Extended; $[sysutils.pas
function return string s to floating-point number
Indicates that the default value of the string is not a floating-point representation
Reference function Sysutils.texttofloat
Example Var e:extended; Begin E: = Strtofloatdef (edit1.text, 0); End
━━━━━━━━━━━━━━━━━━━━━
Header function Trystrtofloat (const s:string out value:extended): Boolean; overload; $[sysutils.pas
Header function Trystrtofloat (const s:string out value:single): Boolean; overload; $[sysutils.pas
Header function Trystrtofloat (const s:string out value:double): Boolean; overload; $[sysutils.pas
function returns whether the string s has succeeded in converting to floating-point value
Indicates that a string is not a floating-point expression and returns false and value is output as an indeterminate value
Reference function Sysutils.texttofloat
Example
Begin trystrtofloat
Procedure Tform1.button1click (Sender:tobject);
Var
e:extended;
Begin
checkbox1.checked: = Trystrtofloat (Edit1.text, E);
Edit2.text: = Formatfloat (', E);
End
End Trystrtofloat
━━━━━━━━━━━━━━━━━━━━━
Header function Strtocurr (const s:string): Currency; $[sysutils.pas
function returns the string s into currency number
Indicates an exception when the string is not a currency number expression
Reference function Sysutils.texttofloat
Example Var c:currency; Begin C: = Strtocurr (Edit1.text); End
━━━━━━━━━━━━━━━━━━━━━
Header function Strtocurrdef (const s:string; const default:currency): Currency; $[sysutils.pas
function returns the string s into currency number
Indicates that the default value is returned when the string is not a currency number expression
Reference function Sysutils.texttofloat
Example Var c:currency; Begin C: = Strtocurrdef (edit1.text, 0); End
━━━━━━━━━━━━━━━━━━━━━
Header function Trystrtocurr (const s:string out value:currency): Boolean; $[sysutils.pas
function returns the string s converted to currency number value is successful
Returns False when a string is not a currency number expression and value is output as an indeterminate value
Reference function Sysutils.texttofloat
Example
Begin Trystrtocurr
Procedure Tform1.button1click (Sender:tobject);
Var
c:currency;
Begin
checkbox1.checked: = Trystrtocurr (Edit1.text, C);
Edit2.text: = Formatcurr (', C);
End
End Trystrtocurr
━━━━━━━━━━━━━━━━━━━━━
Header function Texttofloat (buffer:pchar var Value; Valuetype:tfloatvalue): Boolean; $[sysutils.pas
function returns the conversion of the pointer string buffer to a type-free variable value
Description valuetype specifies a type with no type parameter value
Reference <NULL>
Example
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
━━━━━━━━━━━━━━━━━━━━━
First procedure Floattodecimal (var result:tfloatrec; const Value; Valuetype:tfloatvalue; Precision, Decimals:integer); $[sysutils.pas
function converts floating-point numbers to floating-point structure types and returns to result
Description valuetype specified type; Precision specified precision; decimals Specify decimal
Reference type Sysutils.tfloatrec
Example <NULL>
━━━━━━━━━━━━━━━━━━━━━
First function Datetimetotimestamp (datetime:tdatetime): Ttimestamp; $[sysutils.pas
Feature return date time type converted to time structure type
Description <NULL>
Reference type Sysutils.ttimestamp
Example <NULL>
━━━━━━━━━━━━━━━━━━━━━
Header function Timestamptodatetime (const timestamp:ttimestamp): Tdatetime; $[sysutils.pas
function return time structure type converted to date Time type
Description <NULL>
Reference type Sysutils.ttimestamp
Example <NULL>
━━━━━━━━━━━━━━━━━━━━━
First function Msecstotimestamp (msecs:comp): Ttimestamp; $[sysutils.pas
Feature return subtle conversion to time structure type
Description <NULL>
Reference type Sysutils.ttimestamp
Example <NULL>
━━━━━━━━━━━━━━━━━━━━━
Header function Timestamptomsecs (const timestamp:ttimestamp): Comp; $[sysutils.pas
function return time structure type convert to subtle
Description <NULL>
Reference type Sysutils.ttimestamp
Example <NULL>
━━━━━━━━━━━━━━━━━━━━━
First function encodedate (year, Month, Day:word): Tdatetime; $[sysutils.pas
Feature returns the date of the merged year, month, day
Indicates an exception is triggered when an illegal combination occurs
Reference function Sysutils.tryencodedate
Example Edit1.text: = Datetostr (Encodedate (Spinedit1.value, Spinedit2.value, Spinedit3.value));
━━━━━━━━━━━━━━━━━━━━━
First function Encodetime (Hour, Min, Sec, Msec:word): Tdatetime; $[sysutils.pas
function returns the time that is obtained when merging, minutes, seconds, and microseconds
Indicates an exception is triggered when an illegal combination occurs
Reference function Sysutils.tryencodetime
Example Edit1.text: = Timetostr (Encodetime (Spinedit1.value, Spinedit2.value, Spinedit3.value, Spinedit4.value));
━━━━━━━━━━━━━━━━━━━━━
First function tryencodedate (year, Month, Day:word. Out date:tdatetime): Boolean; $[sysutils.pas
Feature returns whether the date of the merged year, month, or day is successful
Description returns False when an illegal combination occurs and the date output is 0
Reference function Sysutils.isleapyear
Example
Begin tryencodedate
Procedure Tform1.button1click (Sender:tobject);
Var
Vdate:tdate;
Begin
checkbox1.checked: = Tryencodedate (Spinedit1.value, Spinedit2.value,
Spinedit3.value, Tdatetime (vdate));
Edit1.text: = Datetostr (vdate);
End
End Tryencodedate
━━━━━━━━━━━━━━━━━━━━━
First function Tryencodetime (Hour, Min, Sec, Msec:word; out time:tdatetime): Boolean; $[sysutils.pas
function returns whether the time of merging, minutes, seconds, microseconds has been successful
Description returns False when an illegal combination occurs and the time output is 0
Reference Const SYSUTILS.MSECSPERDAY
Example
Begin Tryencodetime
Procedure Tform1.button1click (Sender:tobject);
Var
Vtime:ttime;
Begin
checkbox1.checked: = Tryencodetime (Spinedit1.value, Spinedit2.value,
Spinedit3.value, Spinedit3.value, Tdatetime (vtime));
Edit1.text: = Timetostr (Vtime);
End
End Tryencodetime
━━━━━━━━━━━━━━━━━━━━━
First procedure decodedate (const Datetime:tdatetime; var year, Month, Day:word); $[sysutils.pas
Feature decomposition date is year, month, day
Description <NULL>
Reference function sysutils.decodedatefully
Example
Begin decodedate
Procedure Tform1.button1click (Sender:tobject);
Var
Year, Month, Day:word;
Begin
Decodedate (Date, year, Month, day);
Spinedit1.value: = year;
Spinedit2.value: = Month;
Spinedit3.value: = day;
End
End Decodedate
━━━━━━━━━━━━━━━━━━━━━
Header function decodedatefully (const datetime:tdatetime; var year, Month, Day, Dow:word): Boolean; $[sysutils.pas
Feature breakdown date is year, month, day, week
Description [Dow:day of Week]
Reference function Sysutils.datetimetotimestamp
Example
Begin decodedatefully
Procedure Tform1.button1click (Sender:tobject);
Var
Year, Month, Day, Dow:word;
Begin
Decodedatefully (Date, year, Month, Day, DOW);
Spinedit1.value: = year;
Spinedit2.value: = Month;
Spinedit3.value: = day;
Spinedit4.value: = DOW;
End
End decodedatefully
━━━━━━━━━━━━━━━━━━━━━
Header function internaldecodedate (const datetime:tdatetime; var year, Month, Day, Dow:word): Boolean; $[sysutils.pas
function <NULL>
Description Kylix function
Reference function sysutils.decodedatefully
Example <NULL>
━━━━━━━━━━━━━━━━━━━━━
First procedure decodetime (const datetime:tdatetime; var Hour, Min, Sec, Msec:word); $[sysutils.pas
function decomposition time last, minute, second, subtle
Description <NULL>
Reference function Sysutils.datetimetotimestamp
Example
Begin Decodetime
Procedure Tform1.button1click (Sender:tobject);
Var
Hour, Min, Sec, Msec:word;
Begin
Decodetime (Time, Hour, Min, Sec, MSEC);
Spinedit1.value: = Hour;
Spinedit2.value: = Min;
Spinedit3.value: = Sec;
Spinedit4.value: = MSec;
End
End Decodetime
━━━━━━━━━━━━━━━━━━━━━
First procedure datetimetosystemtime (const datetime:tdatetime; var systemtime:tsystemtime); $[sysutils.pas
Feature return date time type to system time type
Description <NULL>
Reference function Sysutils.decodedatefully;function Sysutils.decodetime
Example <NULL>
━━━━━━━━━━━━━━━━━━━━━
Header function Systemtimetodatetime (const systemtime:tsystemtime): Tdatetime; $[sysutils.pas
function return system time type to date Time type
Description <NULL>
Reference function Sysutils.encodedate;function Sysutils.encodetime
Example <NULL>
━━━━━━━━━━━━━━━━━━━━━
Header function DayOfWeek (const datetime:tdatetime): Word; $[sysutils.pas
function returns the week on which datetime dates
Description 1 (Sunday), 2 (Monday), 3 (Tuesday), 4 (Wednesday), 5 (Thursday), 6 (Friday), 7 (Saturday)
Reference function Sysutils.datetimetotimestamp
Example
Begin DayOfWeek
Procedure Tform1.button1click (Sender:tobject);
Const
CWEEKCN:ARRAY[1..7] of String =
(' Sunday ', ' Monday ', ' Tuesday ', ' Wednesday ', ' Thursday ', ' Friday ', ' Saturday ');
Begin
Edit1.text: = Cweekcn[dayofweek (now)];
End
End DayOfWeek
━━━━━━━━━━━━━━━━━━━━━
First function Date:tdatetime; $[sysutils.pas
Feature returns the current date
Description Date-int (Date) = 0;
Reference function sysutils.datetimetostring
Example Edit1.text: = Datetostr (Date);
━━━━━━━━━━━━━━━━━━━━━
First function Time:tdatetime; $[sysutils.pas
Feature returns the current time
Description Time-frac (time) = 0;
Reference function Windows.getlocaltime;function Sysutils.encodetime
Example Edit1.text: = Timetostr (time);
━━━━━━━━━━━━━━━━━━━━━
First function Now:tdatetime; $[sysutils.pas
Feature returns the current date time
Description Date + Time=now
Reference function Windows.getlocaltime;function sysutils.encodedate;function sysutils.encodetime
Example Edit1.text: = Datetimetostr (now);
━━━━━━━━━━━━━━━━━━━━━
First function Currentyear:word; $[sysutils.pas
Feature returns the current year
Description <NULL>
Reference function Windows.getlocaltime
Example Spinedit1.value: = CurrentYear;
━━━━━━━━━━━━━━━━━━━━━
First function incmonth (const datetime:tdatetime; Numberofmonths:integer = 1): tdatetime; $[sysutils.pas
Feature returns increased month to date
Indicates that the month is reduced when numberofmonths is negative
Reference procedure Sysutils.decodedate;procedure sysutils.incamonth;function sysutils.encodedate;procedure Sysutils.replacetime
Example datetimepicker1.date: = Incmonth (Date, Spinedit1.value);
━━━━━━━━━━━━━━━━━━━━━
First procedure Incamonth (Var year, Month, Day:word; Numberofmonths:integer = 1); $[sysutils.pas
function returns the month to date
Indicates that the month is reduced when numberofmonths is negative
Reference procedure System.inc
Example
Begin Incamonth
Procedure Tform1.button1click (Sender:tobject);
Var
Vyear, Vmonth, Vday:word;
Begin
Decodedate (Date, Vyear, Vmonth, vday);
Incamonth (Vyear, Vmonth, Vday, Spinedit1.value);
Datetimepicker1.date: = Encodedate (Vyear, Vmonth, vday);
End
End Incamonth
━━━━━━━━━━━━━━━━━━━━━
First procedure Replacetime (var datetime:tdatetime; const newtime:tdatetime); $[sysutils.pas
The time part of a function to replace DateTime newtime with TIME
Description Int (DateTime) + frac (newtime)
Reference function System.trunc;function system.abs;function System.frac
Example
Begin Replacetime
Procedure Tform1.button1click (Sender:tobject);
Var
Vdatetime:tdatetime;
Begin
Vdatetime: = Now;
Replacetime (Vdatetime, datetimepicker1.time);
Edit1.text: = Datetimetostr (Vdatetime);
End
End Replacetime
━━━━━━━━━━━━━━━━━━━━━
First procedure replacedate (var datetime:tdatetime; const newdate:tdatetime); $[sysutils.pas
Feature replaces date part of datetime date with date newdate
Description Int (newtime) + frac (DateTime)
Reference procedure Sysutils.replacetime
Example
Begin replacedate
Procedure Tform1.button1click (Sender:tobject);
Var
Vdatetime:tdatetime;
Begin
Vdatetime: = Now;
Replacedate (Vdatetime, datetimepicker1.date);
Edit1.text: = Datetimetostr (Vdatetime);
End
End Replacedate
━━━━━━━━━━━━━━━━━━━━━
Header function Isleapyear (year:word): Boolean; $[sysutils.pas
Feature returns year is a leap years
Description (Year mod 4 = 0) and (year mod <> 0) or (year mod 400 = 0))
Reference <NULL>
Example checkbox1.checked: = Isleapyear (Spinedit1.value);
━━━━━━━━━━━━━━━━━━━━━
Header function Datetostr (const datetime:tdatetime): string; $[sysutils.pas
Feature return date datetime converted to string
Description conversion format is controlled by system variable Shortdateformat
Reference function Sysutils.datetimetostring;var Sysutils.shortdateformat
Example Edit1.text: = Datetostr (Date);
━━━━━━━━━━━━━━━━━━━━━
Header function Timetostr (const datetime:tdatetime): string; $[sysutils.pas
function return time datetime to string
Description conversion format is controlled by system variable Longtimeformat
Reference function Sysutils.datetimetostring;var Sysutils.longtimeformat
Example Edit1.text: = Timetostr (Date);
━━━━━━━━━━━━━━━━━━━━━
Header function Datetimetostr (const datetime:tdatetime): string; $[sysutils.pas
Feature return datetime date to string
Description conversion format is controlled by system variable Shortdateformat and Longtimeformat
Reference function sysutils.datetimetostring
Example Edit1.text: = Datetimetostr (now);
━━━━━━━━━━━━━━━━━━━━━
Header function Strtodate (const s:string): Tdatetime; $[sysutils.pas
function return string s to date
An exception is caused when the description character Fu Fei the date expression
Reference function Sysutils.trystrtodate
Example datetimepicker1.date: = Strtodate (Edit1.text);
━━━━━━━━━━━━━━━━━━━━━
Header function Strtodatedef (const s:string; const default:tdatetime): Tdatetime; $[sysutils.pas
function return string s to date
The default value is returned when the description character Fu Fei the date expression
Reference function Sysutils.trystrtodate
Example datetimepicker1.date: = Strtodatedef (Edit1.text, Date);
━━━━━━━━━━━━━━━━━━━━━
Header function Trystrtodate (const s:string out value:tdatetime): Boolean; $[sysutils.pas
function returns whether the string s converted to date value is successful
Description Word returns False when Fu Fei date expression and value is output 0
Reference <NULL>
Example
Begin trystrtodate
Procedure Tform1.button1click (Sender:tobject);
Var
Vdatetime:tdatetime;
Begin
checkbox1.checked: = Trystrtodate (Edit1.text, vdatetime);
Datetimepicker1.date: = Vdatetime;
End
End Trystrtodate
━━━━━━━━━━━━━━━━━━━━━
Header function Strtotime (const s:string): Tdatetime; $[sysutils.pas
function returns the string s converted into time
Descriptive character Fu Fei time expression will cause an exception
Reference function Sysutils.trystrtotime
Example Datetimepicker1.time: = Strtotime (Edit1.text);
━━━━━━━━━━━━━━━━━━━━━
Header function Strtotimedef (const s:string; const default:tdatetime): Tdatetime; $[sysutils.pas
function returns the string s converted into time
The default value is returned when the description character Fu Fei time expression
Reference function Sysutils.trystrtotime
Example Datetimepicker1.time: = Strtotimedef (Edit1.text, time);
━━━━━━━━━━━━━━━━━━━━━
Header function Trystrtotime (const s:string out value:tdatetime): Boolean; $[sysutils.pas
function returns whether the string s converted to time value is successful
Description Word returns False when Fu Fei time expression and value is output to 0
Reference <NULL>
Example
Begin Trystrtotime
Procedure Tform1.button1click (Sender:tobject);
Var
Vdatetime:tdatetime;
Begin
checkbox1.checked: = Trystrtotime (Edit1.text, vdatetime);
Datetimepicker1.time: = Vdatetime;
End
End Trystrtotime
━━━━━━━━━━━━━━━━━━━━━
Header function Strtodatetime (const s:string): Tdatetime; $[sysutils.pas
function return string s to date time
Descriptive word Fu Fei the date-time expression will cause an exception
Reference function Sysutils.trystrtodatetime
Example Edit1.text: = Datetimetostr (Strtodatetime (Edit2.text));
━━━━━━━━━━━━━━━━━━━━━
Header function Strtodatetimedef (const s:string; const default:tdatetime): Tdatetime; $[sysutils.pas
function return string s to date time
The default value is returned when the descriptive word Fu Fei the date time expression
Reference function Sysutils.trystrtodatetime
Example Edit1.text: = Datetimetostr (Strtodatetimedef (Edit2.text, now));
━━━━━━━━━━━━━━━━━━━━━
Header function Trystrtodatetime (const s:string out value:tdatetime): Boolean; $[sysutils.pas
function return string s to date time value is successful
The description character Fu Fei The datetime expression returns false and value is output to 0
Reference <NULL>
Example
Begin Trystrtodatetime
Procedure Tform1.button1click (Sender:tobject);
Var
Vdatetime:tdatetime;
Begin
checkbox1.checked: = Trystrtodatetime (Edit1.text, vdatetime);
Edit2.text: = Datetimetostr (Vdatetime);
End
End Trystrtodatetime
━━━━━━━━━━━━━━━━━━━━━
First function FormatDateTime (const format:string; Datetime:tdatetime): string; $[sysutils.pas
Feature returns the format of datetime with the specified formatting format
Description FormatDateTime (' YYYY "MM" month "DD" Day ", Strtodate (' 2002-03-09 ')) = ' March 09, 2002 '
Reference function sysutils.datetimetostring
Example Edit2.text: = FormatDateTime (Edit1.text, now);
━━━━━━━━━━━━━━━━━━━━━
First procedure datetimetostring (var result:string; const format:string; Datetime:tdatetime); $[sysutils.pas
Feature formats datetime dates and returns to string result in the specified format.
Description < See formatdatetime>
Reference function system.setstring
Example < see formatdatetime>
━━━━━━━━━━━━━━━━━━━━━
Header function Floattodatetime (const value:extended): Tdatetime; $[sysutils.pas
function returns floating-point number to date time type
Indicates that if a floating-point number goes out of range, an exception is fired
Reference function System.int
Example Edit2.text: = Datetimetostr (Floattodatetime (strtofloatdef (edit1.text, 0));
━━━━━━━━━━━━━━━━━━━━━
Header function Syserrormessage (errorcode:integer): string; $[sysutils.pas
function returns information about the error code in the system
Explains that this letter can help users who are accustomed to Windows programming to use
Reference function Windows.formatmessage;function system.setstring
Example Edit1.text: = Syserrormessage (Spinedit1.value);
━━━━━━━━━━━━━━━━━━━━━
Header function Getlocalestr (Locale, Localetype:integer; const default:string): string; Platform $[sysutils.pas
function returns the string value of the current system-specified parameter
Description Getlocalestr (Getthreadlocale, locale_slanguage, ') = ' Chinese (China) '
Reference function Windows.getlocaleinfo
Example Edit1.text: = Getlocalestr (Getthreadlocale, Spinedit1.value, ' <NULL> ');
━━━━━━━━━━━━━━━━━━━━━
First function Getlocalechar (Locale, Localetype:integer; Default:char): Char; Platform $[sysutils.pas
Feature returns the character value of the current system-specified parameter
Description Getlocalechar (Getthreadlocale, Locale_sthousand, #0) = ', '
Reference function Windows.getlocaleinfo
Example Edit1.text: = Getlocalechar (Getthreadlocale, Locale_slanguage, #0);
━━━━━━━━━━━━━━━━━━━━━
The first procedure getformatsettings; $[sysutils.pas
Feature recovery system parameter settings
Description Date Time Format etc
Reference function Windows.getthreadlocale;function Windows.getlocalestr
Example
Begin getformatsettings
Procedure Tform1.button1click (Sender:tobject);
Begin
Shortdateformat: = ' YYYY ' year ' MM ' month ' DD ' Day ';
ShowMessage (Datetostr (Date));
Getformatsettings;
ShowMessage (Datetostr (Date));
End
End Getformatsettings
━━━━━━━━━━━━━━━━━━━━━