Summary of Delphi Common system functions

Source: Internet
Author: User
Tags control characters cos mathematical functions ord value of pi

String handling functions

Unit System

Function prototype functions Concat (S1 [, S2,..., sn]: string): string; Description with S: = S1 + S2 + S3 ...; Same. Adds a string.

Functional prototype function Copy (s:string; Index, Count:integer): string; description S: Strings. Indexd: Copy starting from the first few. Count: Copy a total of several. Copy from the female string to another string.

Function prototype procedure Delete (Var s:string; Index, Count:integer); description S: String. Indexd: Delete From the beginning of the first few. Count: There are a total of several deletions. Deletes several characters in a string.

Function prototype procedure Insert (source:string; var s:string; Index:integer); Description Source: substring. S: The string is inserted. INDEXD: Insert from first. Inserts a substring into another string.

Function prototype functions Length (s:string): Integer; To find the number of characters

Functional prototype function Pos (substr:string; s:string): Integer; Description Substr: substring. S: female string. Looks for the position of the substring in the parent string.

Functional prototype function lowercase (const s:string): string; Converts all strings to lowercase letters.

Functional prototype function uppercase (const s:string): string; Converts all strings to uppercase letters.

POS (Obj,target) finds the first character position in the target string where obj appears, and returns 0 if it is not found.

function StringReplace (const S, Oldpattern, newpattern:string; Flags:treplaceflags): string; function returns the replacement string description Rfreplaceall to replace the entire contents; Rfignorecase to ignore case

function Stringtoguid (const s:string): Tguid; feature return string S converted to global identity description if the string is illegal, the exception will be triggered

function guidtostring (const GUID:TGUID): string; feature returns global identity GUID converted to string

Function prototype procedure Str (X [: Width [: decimals]]; var S); Converts a numeric value to a formatted string. Description X: The integer or real number to convert. Width: Format length. (Integer) Decimals: The number of decimal places. (Integer)

Function prototype procedure Val (S; var V; var code:integer); Converts a string to a number. Description S: The string to convert. V: The converted integer or real number. Code:code = 0 indicates a successful conversion.

Unit sysutils

Functional prototype function newstr (const s:string): pstring; Configure a new string space in the heap to give the pstring pointer.

Function prototype procedure disposestr (p:pstring); Frees a string space pstring pointer in the heap.

Functional prototype function Inttohex (Value:integer; Digits:integer): string;

Functional prototype function IntToStr (Value:integer): string;

Functional prototype function Strtoint (const s:string): Integer;

Functional prototype function strtointdef (const s:string; Default:integer): Integer; Description Value: The integer to convert. Digits: Hex to convert to several numbers.

Function prototype functions Trim (const s:string): string; The whitespace and control characters before and after the string are cleared out.

Functional prototype function Trimleft (const s:string): string; Clear whitespace and control characters to the left of the string.

Functional prototype function trimright (const s:string): string; Clear the whitespace and control characters to the right of the string.

Functional prototype function Adjustlinebreaks (const s:string): string; Change the newline symbol of a string to #13#10

Functional prototype function Stralloc (size:cardinal): PChar; Configures the string space. Description size= string Maximum space +1

Functional prototype function strbufsize (Str:pchar): Cardinal; Returns the size of the configured space by Stralloc

Functional prototype function StrCat (Dest, Source:pchar): PChar; The string is added.

Function prototype functions StrComp (STR1, Str2:pchar): Integer; Compares two string sizes.

Functional prototype function strcopy (Dest, Source:pchar): PChar; Copy the string.

Function prototype procedure strdispose (Str:pchar); Frees the space configured by the Stralloc or strnew.

Functional prototype function strecopy (Dest, Source:pchar): PChar; Copies the string and returns the end address of the string.

Functional prototype function Strend (Str:pchar): PChar; Returns the end address of the string.

Function prototype functions Stricomp (STR1, Str2:pchar): Integer; Compares two string sizes. (not case sensitive)

Functional prototype function Strlcat (Dest, Source:pchar; maxlen:cardinal): PChar; string addition. (Designation Long)

Functional prototype function Strlcomp (STR1, Str2:pchar; maxlen:cardinal): Integer; Compares two string sizes. (Designation Long)

Functional prototype function strlcopy (Dest, Source:pchar; maxlen:cardinal): PChar; Copy the string. (Designation Long)

Functional prototype function StrLen (Str:pchar): Cardinal; Returns the string length. (does not contain the terminating bit)

Functional prototype function Strlicomp (STR1, Str2:pchar; maxlen:cardinals): Integer; Compares two string sizes. (Specify long, not case)

Functional prototype function Strlower (Str:pchar): PChar; Converts all strings to lowercase letters.

Functional prototype function Strmove (Dest, Source:pchar; count:cardinal): PChar; Copies n bytes from the source string to the target R string. (does not contain the terminating bit)

Functional prototype function strnew (Str:pchar): PChar; Configures the string space.

Functional prototype function Strpas (Str:pchar): string; Converts the null-terminated string to a Pascal-style string.

Functional prototype function strpcopy (Dest:pchar; source:string): PChar; Copies the Pascal-style string to the null-terminated string.

Functional prototype function strplcopy (Dest:pchar; const source:string; maxlen:cardinal): PChar; Copies the Pascal-style string to the null-terminated string. (Designation Long)

Functional prototype function Strpos (STR1, Str2:pchar): PChar; The position of the substring in the parent string. (first position) description STR1 female string; STR2 substring

Functional prototype function Strupper (Str:pchar): PChar; Converts all strings to uppercase letters.

Stralloc configures a buffer with a maximum length of Size-1 to give a null-terminated string function Stralloc (Size:word): PChar;

Strbufsize returns the maximum number of characters that can be stored in a string buffer configured by Stralloc. Strbufsize (S:pchar): Cardinal;

Strcat links two strings and returns the string. function StrCat (Dest, Source:pcar): PChar;

The StrComp is two strings in comparison. function StrComp (STR1, Str2:pchar): Integer;

Strcopy Copy the source string onto the dest. function Strcopy (Dest, Source:pchar): PChar

Strdispose returns a string space. function Strdispose (Str:pchar);

Strecopy copies the source string to dest and returns a pointer to the end of the string. function Strecopy (Dest, Surce:pchar): Pchar;

Strend returns a pointer to the end of the string, function Strend (Str:pchar): Pchar;

Strlcat links the source string to the Dest string and returns the linked string. function Strlcat (Dest, Source:pcar; Maxlen:word): PChar;

Stricomp comparison of two strings with no case difference function Stricomp (STR1, Str2:pchar): Integer;

Strlcomp compares two strings to the specified maximum length function strlcomp (STR1, Str2:pchar; Maxlen:word): Integer;

Strlcopy copies the specified number of characters from one string to another string function strlcopy (Dest,source:pchar; maxlen:cardinal): PChar;

StrLen returns the length of the string. function StrLen (Str:pchar): Cardinal;

Strlicomp compares two strings to a specified maximum length with no case difference. function Strlicomp (STR1, Str2:pchar; Maxlen:word): Integer;

Strlower the string into lowercase. function Strlower (Str:pchar):P char;

Strmove copies count characters, from source to dest string. function Strmove (Dest, Source:pchar; count:cardinal): PChar

Strnew a string from the heap configuration. function strnew (Str:pchar):P char;

Strpas the null-terminated word into a Pascal-formatted string. function Strpas (Str:pchar): String;

Strpcopy copies a Pascal format string to a null-terminated string. Function strpcopy (Dest:pchar; source:string): PChar;

Strplcopy copies the number of characters MaxLen, from the Pascal format string to the null-terminated string. Function strplcopy (Dest:pchar;cost source:string; Maxlen:word): PChar;

Strpos returns a pointer to the position where the STR2 string first appears within the STR1. function Strpos (STR1, Str2:pchar): Pchar;

Strscan returns a pointer to the position of the first occurrence of a CHR character in the STR string. function Strscan (Str:pchar; Chr:char): PChar;

Strrscan returns a pointer to the position of the last occurrence of the CHR character in the STR substring. function Strrscan (Str:pchar; Chr:char): PChar;

Strupper the string into uppercase. function Strupper (Str:pchar):P char;

Date and time functions (date and Times Routines)

Unit:sysutils

Date returns to today's day. function Date:tdatetime;

DATETIMETOSTR convert the time format to a string. function Datetimetostr (datetime:tdatetime): String;

Datetimetostring convert the time format to a string. Procedure Datetimetostring (var result:string;const format:string;datetime:tdatetime);

DATETOSTR Convert the date format to a string. function Datetostr (date:tdatetime): String;

DayOfWeek back to the day of the week. function DayOfWeek (date:tdatetime): Integer; The return value is an integer, 1~7. Sunday for 1.

Decodedate the date specified by the decomposition is year, month, and day. Procedure Decodedate (Date:tdatetime;var year, Month, Day:word);

Decodetime the date specified by the decomposition is the last, minute, and second. Procedure Decodetime (Time:tdatetime;var Hour, Min, Sec,msec:word);

Encodedate returns the date format combined with the year, month, and day. Function encodedate (year, Month, Day:word): Tdatetime;

Encodetime returns the time format that is combined with time, minutes, and seconds. function Encodetime (Hour, Min, Sec, Msec:word): Tdatetime;

FormatDateTime returns the DateTime in the specified format. function FormatDateTime (const format:string;datetime:tdatetime): string;

Now returns the date time. function Now:tdatetime;

Strtodate the string to a date format. function strtodate (const s:string): Tdatetime;

Strtodatetime convert string to datetime Format function strtodatetime (const s:string): Tdatetime;

Strtotime the string to a time format. function Strtotime (const s:string): Tdatetime;

Time is passed back to the present. function Time:tdatetime;

TIMETOSTR convert the time format to a string. function Timetostr (time:tdatetime): String;

File management functions

Unit:sysutils

Functional prototype function Extractfiledir (const filename:string): string;

Functional prototype function extractfiledrive (const filename:string): string;

Functional prototype function Extractfileext (const filename:string): string;

Functional prototype function extractfilename (const filename:string): string;

Functional prototype function Extractfilepath (const filename:string): string;

Functional prototype function DeleteFile (const filename:string): Boolean;

Function prototype functions renamefile (const oldname, newname:string): Boolean;

Functional prototype function fileexists (const filename:string): Boolean;

Function prototype procedure FindClose (Var f:tsearchrec);

Functional prototype function FindFirst (const path:string; Attr:integer; var f:tsearchrec): Integer;

Functional prototype function FindNext (var f:tsearchrec): Integer; instructions successfully passed back to 0

Changefileext the extension of the change file.

function Changefileext (const filename,extension:string): string; Datetimetofiledate converts the Delphi date format to the date format of the DOS.

Functiondatetimetofiledate (datetime:tdatetime): Longint;

DeleteFile Delete a file. function DeleteFile (const filename:string): Boolean;

Diskfree returns the available space on the disk. function Diskfree (drive:byte): Longint;

DiskSize returns the capacity size of the specified disk. function DiskSize (drive:byte): Longint;

Expandfilename returns a full path and file name string. function Expandfilename (const filename:string): string;

Extractfileext returns the extension of the file. function Extractfileext (const FileName string): string;

Extractfilename returns the file name. function Extractfilename (const filename:string): string;

Extractfilepath returns the path to the file. function Extractfilepath (const filename:string): string;

Fileage returns the file's age function fileage (const filename:string): Longint;

Filecreate creates a file with the specified file name. function filecreate (const filename:string): Integer;

FileClose closes the specified file. Procedurefileclose (Handle:integer);

Filedatetodatetime the date format of the DOS to the date format of Delphi. function Filedatetodatetime (filedate:longint): Tdatetime;

FileExists to determine whether a file exists. function fileexists (const filename:string): Boolean;

Filegetattr returns the File property. function filegetattr (const filename:string): Integer;

Filegetdate the date and time that the file was passed back. function Filegetdate (Handle:integer): Longint;

FileRead reads the data from the specified file. function FileRead (Handle:integer; var Buffer; Count:longint): Longint;

FileSearch searches the directory column for the specified file. function FileSearch (Constname, dirlist:string): string;

FileSeek changes the position of the file cursor. function FileSeek (Handle:integer;offset:longint;origin:integer): Longint;

Filesetattr set file properties. function filesetattr (const filename:string; Attr:integer): Integer;

Filesetdate the date and time when the file was set. Procedure Filesetdate (Handle:integer; Age:longint);

FileOpen Open the file. function FileOpen (const filename:string; Mode:word): Integer;

FileWrite write data to file. function FileWrite (Handle:integer;const Buffer; Count:longint): Longint;

FindClose stop looking for the first/next action. Procedure FindClose (var searchrec:tsearchrec);

FindFirst looks for the first compliant file and sets its properties.

function FindFirst (const path:string; Attr:word; var f:tsearchrec): Integer;

FindNext returns the next compliant file. function FindNext (var f:tsearchrec): Integer;

RenameFile change the file name. function RenameFile (const oldname,newname:string): Boolean;

Conversion function (Transfer Routines)

Unit:system

CHR returns the characters corresponding to the ASCII code. function Chr (x:byte): Char;

Delphi Source Task (http://home.kimo.com.tw/bruce0211/) typing finishing 15

High returns the highest value in the range of the three numbers. function High (X);

Low returns the lowest value in the range for the three numbers. function low (X);

ORD returns a sequential value corresponding to an ordered form. function Ord (X): Longint;

Round returns an integer value by rounding a real value. function Round (x:real): Longint;

Trunc returns an integer value to the end of a real value. function Trunc (x:real): Longint;

Pred (x) pred (' D ') = ' C ', pred (true) = 1;

SUCC (x) succ (' Y ') = ' Z ', SUCC (pred (x)) =x

Ord (x) asks for the ordinal number of x in the character set, such as Ord (' A ') =65

Chr (x) CHR = ' A '

Round (x) rounding

Trunc (x) trunc (4.8) =4,trunc ('-3.6 ') =-3

UpCase (x) upcase (' a ') = ' a '

Hi (I) Hi ($2a30) =$2a

Lo (I) lo ($2a30) =$30

Random (n) randomly generated integers between [0,n]

sizeof (name) to find out the number of bytes that a type or variable occupies in memory

Swap (num) swaps int's high and low bit swap ($3621) =$2136

Frac a small part of a real number

R: = Frac (123.456); {0.456}

R: = Frac (-123.456); {-0.456}

int to find integral parts of a real number

R: = Int (123.456); {123.0}

R: = Int (-123.456); {-123.0}

Function prototype functions high (X); Returns the maximum value of the footnote

function prototype functions low (X); Low returns the minimum value of the footnote.

Function prototype functions Ord (X): Longint; Returns the value of the enumeration type.

Functional prototype function Round (x:extended): Longint; Converts a real number to an integer. (with rounding)

Functional prototype function Trunc (x:extended): Longint; Converts a real number to an integer. (Fractional direct discard)

Functional prototype function vararraycreate (const bounds:array of Integer; Vartype:integer): Variant; Create a Variant array.

Functional prototype function vararrayof (const Values:array of Variant): Variant; Create a simple one-dimensional variant array

Functional prototype function Vararraylock (var a:variant): Pointer; Assigns a Variant array ==> to a column variable.

Function prototype procedure Vararrayunlock (Var a:variant); Dismiss the above designation.

Functional prototype function Varisarray (const v:variant): Boolean; Returns whether the variant is an array.

Functional prototype function varisnull (const v:variant): Boolean; Returns whether the variant is null.

Functional prototype function Varastype (const v:variant; Vartype:integer): Variant; A VARIANT that converts a variant to another form.

Function prototype procedure Varcast (var dest:variant; const Source:variant; Vartype:integer); Note VarType cannot be vararray or varbyref.

Functional prototype function VarType (const v:variant): Integer; Returns the Variant form.

Function prototype procedure varclear (Var v:variant); Clears the variant and becomes the unassigned state.

Function prototype procedure varcopy (var dest:variant; const source:variant); Copy a Variant. Description and Dest:=source; the effect is the same.

Functional prototype function Varfromdatetime (datetime:tdatetime): Vari ant; Convert datetime to Variant.

Functional prototype function vartodatetime (const v:variant): Tdatetime; Convert Variant to DateTime.

Function prototype functions Hi (X): Byte; Returns the high-level meta-number. Hi ($1234); {$ $}

Function prototype procedure Include (Var s:set of T; I:T); The description adds the I element to S. Joins an element to a set of elements.

Functions prototype function Lo (X): Byte; Lo ($1234); {$34}

Function prototype procedure Move (Var Source, Dest; Count:integer); Copies n bytes from a source variable to a destination variable.

Functional prototype function Paramcount:integer; The number of incoming variables is added directly from the execution file.

Function prototype functions Paramstr (Index:integer): String, Description paramstr (0); Returns the name of the execution file and the full directory.

Functions prototype function Random [(Range:integer)]; Description 0<=x<range

Functional prototype function Swap (X); Swap swaps the high and low bits of a set of variables.

Functional prototype function UpCase (Ch:char): Char; Convert a character to uppercase.

Function prototype procedure Dec (Var x[; N:longint]); description Dec (X) ==> x:=x-1; Dec (x,n) ==> x:=x-n; Decrements the variable.

Function prototype procedure Inc (Var X [; N:longint]); description Inc (X) ==> x:=x-1;inc (x,n) ==> x:=x-n; Increments the variable.

Functional prototype function ODD (x:longint): Boolean; Check if it is an odd number.

Functional prototype function Assigned (var P): Boolean; Assigned test If the pointer variable is nil. Description when @p=nil ==> returns false

Mathematical functions

Abs returns the absolute value of the three numbers. function Abs (X);

ArcTan returns the inverse function value of the tangent function. function ArcTan (x:real): Real;

COS returns the value of the remaining string function cos (x:real): Real; (X in radians).

EXP returns the value of the natural exponent. function Cos (x:real): Real;

Frac returns the number of decimal parts of a three-digit component. function Frac (x:real): Real;

INT returns the integral parts of the three numbers. function Int (x:real): Real;

Ln returns the natural pair of values. function Ln (x:real): Real;

PI returns the value of Pi Pi. function Pi:real;

Sin returns the value of the sine function. function Sin (x:real): Real;

SQR returns the square of the three numbers. function Sqr (x:real): (Real);

Sqrt returns the square root of the three numbers. function Sqrt (x:real): Real;

Output into function Unit:system

ASSIGNFILE specifies a file to a file variable. Procedure AssignFile (var f, String);

CloseFile close the file. Procedure CloseFile (var F);

Eof determines whether the end of the file has been reached.

Typed or untyped files:functioneof (var F): Booleantext files:function Eof [(Var f:text)]:boolean;

Erase clears the contents of the file. Procedure Erase (var F);

Filepos returns the current file cursor position. function Filepos (var F): Longint;

FileSize returns the size of the file function FileSize (var F): Longint;

Getdir returns the working directory of the specified disk. Procedure Getdir (D:byte; var s:string);

IOResult returns the state of the last I/O execution. function Ioresult:integer;

MkDir to create a subdirectory. Procedure MkDir (s:string);

Rename change the file name of the external files. Procedure Rename (Var F; Newname);

Reset to open a file that already exists. Procedure Reset (Var F [: File; Recsize:word]);

Rewrite Create and open a new file. Procedure Rewrite (Var f:file [; Recsize:word]);

RmDir Delete an empty directory. Procedure RmDir (s:string);

Seek to move a file cursor. Procedure Seek (Var F; N:longint);

Truncate Delete the contents of the file after the current position. Procedure Truncate (var F);

Floating-point conversion function unit:sysutils

Floattodecimal returns the number of floating-point values into fractional and integral parts.

Procedure Floattodecimal (Var Result:tfloatrec; value:extended; Precision, Decimals:integer);

FLOATTOSTRF The floating-point numbers into string descriptions in the specified format.

function floattostrf (value:extended; Format:tfloatformat; Precision,digits:integer): string;

Floattostr a floating-point number into a string description. function Floattostr (value:extended): string;

Floattotext returns the number of floating-point values that are given, divided into fractions and integral parts, according to the format.

function Floattotext (Buffer:pchar; value:extended; Format:tfloatformat; Precision,digits:integer): Integer;

FLOATTOTEXTFMT converts a floating-point number to a string in the format.

function Floattotextfmt (Buffer:pchar; value:extended; Format:pchar): Integer;

The Formatfloat returns the floating-point value in format.

function Formatfloat (constformat:string; value:extended): string;

Strtofloat converts the given string to a floating-point value.

function strtofloat (const s:string): Extended;

Texttofloat to convert a null-terminated string to a floating-point value

function Texttofloat (Buffer:pchar;var value:extended): Boolean;

Process Control Function Unit:system

Break terminates the loop. such as for, while and repeat loops.

The Continue continues to circulate. such as for, while and repeat loops.

Exit to leave the current chunk. Procedure Exit;

Halt stops the execution of the program and returns to the operating system.

Dynamic configuration Function Unit:system

Dispose returns a dynamic variable. Procedure Dispose (var p:pointer);

Free releases a copy of the object. Procedure free;

FREEMEM returns a dynamic variable of a given size. Procedure Freemem (Var p:pointer; Size:word);

Getmem creates a dynamic variable of the specified size and returns the address from the pointer number. Procedure Getmem (Var p:pointer; Size:word);

New creates a dynamic variable and points the pointer three numbers to it. Procedure new (Var p:pointer), function New (<pointer type>):P ointer;

The Maxavail returns the largest contiguous configurable space. function Maxavail:longint;

Memavail returns all of the configurable space. function Memavail:longint;

Pointer-and-address function Unit:system

Addr returns the address of the specified object. function Addr (X): pointer;

Assigned determines whether a function or program is nil function Assigned (var P): Boolean;

CSEG returns the contents of the CS program segment scratchpad. function Cseg:word;

DSEG returns the contents of the DS data segment scratchpad. function Dsegt:word;

OFS returns the partial displacement address of the three numbers. function Ofs (X): Word;

PTR combines the specified segment and offset address into a single pointer. function Ptr (Seg, Ofs:word):P ointer;

The Seg returns the segment address of the three numbers. function Seg (X): Word;

The Sptr returns the contents of the SP stacking register. function Sptr:word;

SSEG returns the contents of the SS stack segment scratchpad. function Sseg:word;

Console function Unit:wincrt

Assigncrt links the text file to a console window. Procedure Assigncrt (var f:text);

Clreol clear the cursor position to all the characters at the end of the line. Procedure Clreol;

CLRSCR clear the screen and reset the cursor to the upper left corner. Procedure CLRSCR;

Cursorto moves the cursor to the given coordinates. Procedure Cursorto (X, Y:integer);

DONEWINCRT end the console window. Procedure Donewincrt;

Gotoxy moves the cursor to the given coordinates. Procedure Gotoxy (X, y:byte);

INITWINCRT set up the console window. Procedure Initwincrt;

Keypressed determine if there is a button. function Keypressed:boolean;

Readbuf reads a line from the console window. function Readbuf (Buffer:pchar; Count:word):

ReadKey read key characters. function Readkey:char;

ScrollTo Scroll the console window to the display location. Procedure ScrollTo (X, Y:integer);

Trackcursor Scrolling console window should be visible to the cursor. Procedure Trackcursor;

Wherex the x-coordinates of the migratory index. function Wherex:byte;

Wherey the Y-label of the migratory target. function Wherey:byte;

Writebuf writes a chunk character to the console window. Procedure Writebuf

Writechar writes a character to the console window. Procedure Writechar (Ch:char);

Summary of Delphi Common system functions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.