Delphi VCL Routines, constants and variables

 

Author:                  Dany Rosseel

Last Update:         27/05/2004

 

Table of contents

1.    Arithmetic Routines.. 3

2.    Character Manipulation Reoutines.. 4

3.    Command Line Utilities.. 4

4.    Comparison Routines.. 4

5.    Date/ Time Routines.. 4

6.    Dialog and Message Routines.. 11

7.    Dynamic Memory Allocation Routines.. 12

8.    Exception Handling Routines.. 12

9.    File Management Routines.. 12

10.      File Name Utilities.. 14

11.      Floating Point Conversion Routines.. 14

12.      Flow Control Routines.. 15

13.      File I/O Procedures.. 15

14.      Measurement Conversion Routines.. 15

15.      Memory Management Routines.. 20

16.      Minimum and Maximum values.. 21

17.      Miscellaneous Routines.. 21

18.      Numeric Formatting Routines.. 22

19.      Ordinal Routines.. 22

20.      Printer Support.. 22

21.      Pointer and Address Routines.. 22

22.      Random Number Routines.. 22

23.      Set Handling Routines.. 22

24.      String Formatting Routines.. 23

25.      String Handling Routines.. 23

26.      String Handling Routines (null terminated) 25

27.      Termination Procedure Support.. 26

28.      Text File Routines.. 26

29.      Trigonometry Routines.. 26

30.      Type Conversion Routines.. 27

 

Name

Unit

Brief explanation

1.       Arithmetic Routines

 

 

Updated on 25-5-2004

function Abs(X);

System

Returns an absolute value.

function Ceil(X: Extended):Integer;

Math

Rounds variables up toward positive infinity.

function CompareValue(const A, B: Integer): TValueRelationship; overload;

function CompareValue(const A, B: Int64): TValueRelationship; overload;

function CompareValue(const A, B: Single; Epsilon: Single = 0): TValueRelationship; overload;

function CompareValue(const A, B: Double; Epsilon: Double = 0): TValueRelationship; overload;

function CompareValue(const A, B: Extended; Epsilon: Extended = 0): TValueRelationship; overload;

Math

Returns the relationship between two numeric values.

procedure DivMod(Dividend: Integer; Divisor: Word; var Result, Remainder: Word);

Math

Returns the result of an integer division, including the remainder.

function EnsureRange(const AValue, AMin, AMax: Integer): Integer; overload;

function EnsureRange(const AValue, AMin, AMax: Int64): Int64; overload;

function EnsureRange(const AValue, AMin, AMax: Double): Double; overload;

Math

Returns the closest value to a specified value within a specified range.

function Exp(X: Real): Real;

System

Returns the exponential of X.

function Floor(X: Extended): Integer;

Math

Rounds variables toward negative infinity.

function Frac(X: Extended): Extended;

System

Returns the fractional part of a real number.

procedure Frexp(X: Extended; var Mantissa: Extended; var Exponent: Integer)

Math

Separates the Mantissa and Exponent of X

const Infinity =  1.0 / 0.0;

Math

Represents positive infinity.

function InRange(const AValue, AMin, AMax: Integer): Boolean; overload;

function InRange(const AValue, AMin, AMax: Int64): Boolean; overload;

function InRange(const AValue, AMin, AMax: Double): Boolean; overload;

Math

Indicates whether a value falls within a specified range.

function Int(X: Extended): Extended;

System

Returns the integer part of a real number.

function IntPower(Base: Extended; Exponent: Integer): Extended;

Math

Calculates the integral power of a base value.

function IsInfinite(const AValue: Double): Boolean;

Math

Indicates when a variable or expression represents an infinite value.

function IsNan(const AValue: Double): Boolean;

Math

Indicates when a variable or expression does not evaluate to a numeric value.

function IsZero(const A: Single; Epsilon: Single = 0): Boolean; overload;

function IsZero(const A: Double; Epsilon: Double = 0): Boolean; overload;

function IsZero(const A: Extended; Epsilon: Extended = 0): Boolean; overload;

Math

Indicates when a floating-point variable or expression evaluates to zero, or very close to zero.

function Ldexp(X: Extended; P: Integer): Extended;

Math

Calculates X * (2**P)

function Ln(X: Real): Real;

System

Returns the natural log of a real expression

function LnXP1(X: Extended): Extended;

Math

Returns the natural log of (X+1)

function Log10(X: Extended): Extended;

Math

Calculates log base 10

function Log2(X: Extended): Extended;

Math

Calculates log base 2

function LogN(N, X: Extended): Extended;

Math

Calculates log base N.

function Max(A,B: Extended): Extended; overload;[1]

Math

Returns the greater of two numeric values.

function Min(A,B: Integer): Integer; overload;1

Math

Returns the lesser of two numeric values.

const NaN =  0.0 / 0.0;

Math

Represents a value that is not a number.

const NegInfinity = -1.0 / 0.0;

Math

Represents negative infinity.

function Pi: Extended;

System

Returns 3.1415926535897932385.

function Poly(X: Extended; const Coefficients: array of Double): Extended;

Math

Evaluates a uniform polynomial of one variable at the value X.

function Power(Base, Exponent: Extended): Extended;

Math

Raises Base to any power.

function Round(X: Extended): Int64;

System

Returns the value of X rounded to the nearest whole number

function RoundTo(const AValue: Double; const ADigit: TRoundToRange): Double;

Math

Rounds a floating-point value to a specified digit or power of ten using “Banker’s rounding”.

function SameValue(const A, B: Single; Epsilon: Single = 0): Boolean; overload;

function SameValue(const A, B: Double; Epsilon: Double = 0): Boolean; overload;

function SameValue(const A, B: Extended; Epsilon: Extended = 0): Boolean; overload;

Math

Indicates whether two floating-point values are (approximately) equal.

function Sign(const AValue: Double): TValueSign; overload;

function Sign(const AValue: Integer): TValueSign; overload;

function Sign(const AValue: Int64): TValueSign; overload;

Math

Indicates whether a numeric value is positive, negative, or zero.

function SimpleRoundTo(const AValue: Double; const ADigit: TSimpleRoundToRange = -2): Double;

Math

Rounds a floating-point value to a specified digit or power of ten using asymmetric arithmetic rounding.

function Sqr(X: Extended): Extended;

System

Returns the square of a number

function Sqrt(X: Extended): Extended;

System

Returns the square root of X

function Trunc(X: Extended): Int64;

System

Truncates a real number to an integer

 

2.       Character Manipulation Reoutines

 

 

Created on 25-5-2004

function Chr(X: Byte): Char;

System

Returns the character for a specified ASCII value

procedure FillChar(var X; Count: Integer; Value: Byte);

System

Fills contiguous bytes with a specified value.

function UpCase(Ch: Char): Char;

System

Converts a character to uppercase.

 

3.       Command Line Utilities

 

 

Checked on 25-5-2004

var CmdLine: PChar;

System

CmdLine is a pointer to the command-line arguments specified when the application is invoked

function FindCmdLineSwitch(const Switch: string; SwitchChars: TSysCharSet; IgnoreCase: Boolean): Boolean;

SysUtils

Determines whether a string was passed as a command line argument to the application

function ParamCount: Integer;

System

Returns the number of parameters passed on the command line

function ParamStr(Index: Integer): string;

System

Returns a specified parameter from the command-line

 

4.       Comparison Routines

 

 

Created on 26-5-2004

function CollectionsEqual(C1, C2: TCollection; Owner1, Owner2: TComponent): Boolean;

Classes

Compares the contents of two collections.

function CompareMem(P1, P2: Pointer; Length: Integer): Boolean; assembler;

SysUtils

Performs a binary comparison of two memory images.

function EqualRect(const R1, R2: TRect): Boolean;

Classes

Indicates whether two TRect values are the same.

 

5.       Date/ Time Routines

 

 

Updated on 26-5-2004

procedure CheckSqlTimeStamp(const ASQLTimeStamp : TSQLTimeStamp);

SqlTimSt

Checks whether a TSQLTimeStamp value represents a valid date and time.

function CompareDate(const A, B: TDateTime): TValueRelationship;

DateUtils

Indicates the relationship between the date portions of two TDateTime values.

function CompareDateTime(const A, B: TDateTime): TValueRelationship;

DateUtils

Indicates the relationship between two TDateTime values.

function CompareTime(const A, B: TDateTime): TValueRelationship;

DateUtils

Indicates the relationship between the time portions of two TDateTime values.

function CurrentYear: Word;

SysUtils

Returns the current year.

function Date: TDateTime;

SysUtils

Returns the current date

const DateDelta

SysUtils

Specifies the correction factor when computing the difference between two date and time types that do not begin in the same year

function DateOf(const AValue: TDateTime): TDateTime;

DateUtils

Strips the time portion from a TDateTime value.

function DateTimeToFileDate(DateTime: TDateTime): Integer;

SysUtils

Converts a TDateTime object to a DOS date-and-time value

function DateTimeToSQLTimeStamp(const DateTime: TDateTime): TSQLTimeStamp);

SqlTimSt

Converts a TDateTime value to a TSQLTimeStamp value.

function DateTimeToStr(DateTime: TDateTime): string;

SysUtils

Converts a TDateTime value to a string

procedure DateTimeToString(var Result: string; const Format: string; DateTime: TDateTime);

SysUtils

Converts a TDateTime value to a string using a specified Format

procedure DateTimeToSystemTime(DateTime: TDateTime; var SystemTime: TSystemTime);

SysUtils

Converts a TDateTime value into the Win32 API's TSystemTime type

function DateTimeToTimeStamp(DateTime: TDateTime): TTimeStamp;

SysUtils

Converts a TDateTime value into the corresponding TTimeStamp value.

function DateToStr(Date: TDateTime): string;

SysUtils

Converts a TDateTime value to a string.

const

  DayMonday = 1;

  DayTuesday = 2;

  DayWednesday = 3;

  DayThursday = 4;

  DayFriday = 5;

  DaySaturday = 6;

  DaySunday = 7;

DateUtils

Provide symbolic constants for ISO 8601-compliant day of the week values.

function DayOf(const AValue: TDateTime): Word;

DateUtils

Returns the day of the month represented by a TDateTime value.

function DayOfTheMonth(const AValue: TDateTime): Word;

DateUtils

Returns the day of the month represented by a TDateTime value.

function DayOfTheWeek(const AValue: TDateTime): Word;

DateUtils

Returns the day of the week represented by a TDateTime value.

function DayOfTheYear(const AValue: TDateTime): Word;

DateUtils

Returns the number of days between a specified TDateTime value and December 31 of the previous year.

function DayOfWeek(Date: TDateTime): Integer;

SysUtils

Returns the day of the week for a specified date.

function DaysBetween(const ANow, AThen: TDateTime): Integer;

DateUtils

Returns the number of whole days between two specified TDateTime values.

function DaysInAMonth(const AYear, AMonth: Word): Word;

DateUtils

Returns the number of days in a specified month of a specified year.

function DaysInAYear(const AYear: Word): Word;

DateUtils

Returns the number of days in a specified year.

function DaysInMonth(const AValue: TDateTime): Word;

DateUtils

Returns the number of days in the month of a specified TDateTime value.

function DaysInYear(const AValue: TDateTime): Word;

DateUtils

Returns the number of days in the year of a specified TDateTime value.

function DaySpan(const ANow, AThen: TDateTime): Double;

DateUtils

Returns the number of days (including fractional days) between two specified TDateTime values.

procedure DecodeDate(Date: TDateTime; var Year, Month, Day: Word);

SysUtils

Returns Year, Month, and Day values for a TDateTime value.

procedure DecodeDateDay(const AValue: TDateTime; out AYear, ADayOfYear: Word);

DateUtils

Returns the year and day of the year for a specified TDateTime value.

function DecodeDateFully(const DateTime: TDateTime; var Year, Month, Day, DOW: Word): Boolean;

SysUtils

Returns Year, Month, and Day, and Day-of-Week values for a TDateTime value.

procedure DecodeDateMonthWeek(const AValue: TDateTime; out AYear, AMonth, AWeekOfMonth, ADayOfWeek: Word);

DateUtils

Returns the year, month, week of the month, and day of the week for a specified TDateTime value.

procedure DecodeDateTime(const AValue: TDateTime; out AYear, AMonth, ADay, AHour, AMinute, ASecond, AMilliSecond: Word);

DateUtils

Returns Year, Month, Day, Hour, Minute, Second, and MilliSecond values for a TDateTime value.

procedure DecodeDateWeek(const AValue: TDateTime; out AYear, AWeekOfYear, ADayOfWeek: Word);

DateUtils

Returns the year, week of the year, and day of the week for a specified TDateTime value.

procedure DecodeDayOfWeekInMonth(const AValue: TDateTime; out AYear, AMonth, ANthDayOfWeek, ADayOfWeek: Word);

DateUtils

For a given TDateTime value, returns the year, month, day of the week, and the count of that day of the week in the month.

procedure DecodeTime(Time: TDateTime; var Hour, Min, Sec, MSec: Word);

SysUtils

Breaks a TDateTime value into hours, minutes, seconds, and milliseconds.

function EncodeDateDay(const AYear, ADayOfYear: Word): TDateTime;

DateUtils

Returns a TDateTime value that represents a specified day of the year for a specified year.

function EncodeDateMonthWeek(const AYear, AMonth, AWeekOfMonth: Word; const ADayOfWeek: Word = 1): TDateTime;

DateUtils

Returns a TDateTime objectvalue that represents a specified day of a specified week in a specified month and year.

function EncodeDateTime(const AYear, AMonth, ADay, AHour, AMinute, ASecond, AMilliSecond: Word):TDateTime;

DateUtils

Returns a TDateTime value that represents a specified year, month, day, hour, minute, second, and millisecond.

function EncodeDateWeek(const AYear, AWeekOfYear: Word; const ADayOfWeek: Word = 1): TDateTime;

DateUtils

Returns a TDateTime value that represents a specified day of a specified week in a specified year.

function EncodeDayOfWeekInMonth(const AYear, AMonth, ANthDayOfWeek, ADayOfWeek: Word): TDateTime;

DateUtils

Returns a TDateTime value that represents a specified occurrence of a day of the week within a specified month and year.

function EncodeDate(Year, Month, Day: Word): TDateTime;

SysUtils

Returns a TDateTime value that represents a specified Year, Month, and Day.

function EncodeTime(Hour, Min, Sec, MSec: Word): TDateTime;

SysUtils

Returns a TDateTime value for a specified Hour, Min, Sec, and MSec.

function EndOfADay(const AYear, ADayOfYear: Word): TDateTime; overload;

function EndOfADay(const AYear, AMonth, ADay: Word): TDateTime; overload;

DateUtils

Returns a TDateTime value that represents the last millisecond of a specified day.

function EndOfAMonth(const AYear, AMonth: Word): TDateTime;

DateUtils

Returns a TDateTime value that represents the last millisecond of the last day of a specified month.

function EndOfAWeek(const AYear, AWeekOfYear: Word; const ADayOfWeek: Word = 7): TDateTime;

DateUtils

Returns a TDateTime value that represents the last millisecond of a specified day of a specified week.

function EndOfAYear(const AYear): TDateTime;

DateUtils

Returns a TDateTime value that represents the last millisecond of a specified year.

function EndOfTheDay(const AValue: TDateTime): TDateTime;

DateUtils

Returns a TDateTime value that represents the last millisecond of the day identified by a specified TDateTime value.

function EndOfTheMonth(const AValue: TDateTime): TDateTime;

DateUtils

Returns a TDateTime value that represents the last millisecond of the last day of the month identified by a specified TDateTime value.

function EndOfTheWeek(const AValue: TDateTime): TDateTime;

DateUtils

Returns a TDateTime value that represents the last millisecond of the last day of the week identified by a specified TDateTime value.

function EndOfTheYear(const AValue: TDateTime): TDateTime;

DateUtils

Returns a TDateTime value that represents the last millisecond of the last day of the year identified by a specified TDateTime value.

function FormatDateTime(const Format: string; DateTime: TDateTime): string;

SysUtils

Formats a TDateTime value.

function HourOf(const AValue: TDateTime): Word;

DateUtils

Returns the hour of the day represented by a TDateTime value.

function HourOfTheDay(const AValue: TDateTime): Word;

DateUtils

Returns the hour of the day represented by a TDateTime value.

function HourOfTheMonth(const AValue: TDateTime): Word;

DateUtils

Returns the number of hours between a specified TDateTime value and 12:00 AM of the first day of the month.

function HourOfTheWeek(const AValue: TDateTime): Word;

DateUtils

Returns the number of hours between a specified TDateTime value and 12:00 AM of the first day of the week.

function HourOfTheYear(const AValue: TDateTime): Word;

DateUtils

Returns the number of hours between a specified TDateTime value and 12:00 AM of the first day of the year.

function HoursBetween(const ANow, AThen: TDateTime): Int64;

DateUtils

Returns the number of whole hours between two specified TDateTime values.

function HourSpan(const ANow, AThen: TDateTime): Double;

DateUtils

Returns the number of Hours (including fractional Hours) between two specified TDateTime values.

procedure IncAMonth(var Year, Month, Day: Word; NumberOfMonths: Integer = 1);

SysUtils

Increments date data by one month.

function IncMonth(const Date: TDateTime; NumberOfMonths: Integer): TDateTime;

SysUtils

Returns a date shifted by a specified number of months

function IncDay(const AValue: TDateTime; const ANumberOfDays: Integer = 1): TDateTime;

DateUtils

Returns a date shifted by a specified number of days.

function IncHour(const AValue: TDateTime; const ANumberOfHours: Int64 = 1): TDateTime;

DateUtils

Returns a date/time value shifted by a specified number of hours.

function IncMilliSecond(const AValue: TDateTime; const ANumberOfMilliSeconds: Int64 = 1): TDateTime;

DateUtils

Returns a date/time value shifted by a specified number of milliseconds.

function IncMinute(const AValue: TDateTime; const ANumberOfMinutes: Int64 = 1): TDateTime;

DateUtils

Returns a date/time value shifted by a specified number of minutes.

function IncMonth(const Date: TDateTime; NumberOfMonths: Integer = 1): TDateTime;

DateUtils

Returns a date shifted by a specified number of months.

function IncSecond(const AValue: TDateTime; const ANumberOfSeconds: Int64 = 1): TDateTime;

DateUtils

Returns a date/time value shifted by a specified number of seconds.

function IncWeek(const AValue: TDateTime; const ANumberOfWeeks: Integer = 1): TDateTime;

DateUtils

Returns a date shifted by a specified number of weeks.

function IncYear(const AValue: TDateTime; const ANumberOfYears: Integer = 1): TDateTime;

DateUtils

Returns a date shifted by a specified number of years.

function IsInLeapYear(const AValue: TDateTime): Boolean;

DateUtils

Indicates whether a specified TDateTime value occurs in a leap year.

function IsLeapYear(Year: Word): Boolean;

SysUtils

Indicates whether a specified year is a leap year.

function IsPM(const AValue: TDateTime): Boolean;

DateUtils

Indicates whether the time portion of a specified TDateTime value occurs after noon.

function IsSameDay(const AValue, ABasis: TDateTime): Boolean;

DateUtils

Indicates whether a specified TDateTime value occurs on a the same day as a criterion date.

function IsToday(const AValue: TDateTime): Boolean;

DateUtils

Indicates whether a specified TDateTime value occurs on the current date.

function IsValidDate(const AYear, AMonth, ADay: Word): Boolean;

DateUtils

Indicates whether a specified year, month, and day represent a valid date.

function IsValidDateDay(const AYear, ADayOfYear: Word): Boolean;

DateUtils

Indicates whether a specified year and day of the year represent a valid date.

function IsValidDateMonthWeek(const AYear, AMonth, AWeekOfMonth, ADayOfWeek: Word): Boolean;

DateUtils

Indicates whether a specified year, month, week of the month, and day of the week represent a valid date.

function IsValidDateTime(const AYear, AMonth, ADay, AHour, AMinute, ASecond, AMilliSecond: Word): Boolean;

DateUtils

Indicates whether a specified year, month, day, hour, minute, second, and millisecond represent a valid date and time.

                       

function IsValidDateWeek(const AYear, AWeekOfYear, ADayOfWeek: Word): Boolean;

DateUtils

Indicates whether a specified year, week of the year, and day of the week represent a valid date.

function IsValidTime(const AHour, AMinute, ASecond, AMilliSecond: Word): Boolean;

DateUtils

Indicates whether a specified hour, minute, second, and millisecond represent a valid date and time.

function MilliSecondOf(const AValue: TDateTime): Word;

DateUtils

 

function MilliSecondOfTheDay(const AValue: TDateTime): LongWord;

DateUtils

 

function MilliSecondOfTheHour(const AValue: TDateTime): LongWord;

DateUtils

 

function MilliSecondOfTheMinute(const AValue: TDateTime): LongWord;

DateUtils

 

function MilliSecondOfTheMonth(const AValue: TDateTime): LongWord;

DateUtils

 

function MilliSecondOfTheSecond(const AValue: TDateTime): Word;

DateUtils

 

function MilliSecondOfTheWeek(const AValue: TDateTime): LongWord;

DateUtils

 

function MilliSecondOfTheYear(const AValue: TDateTime): Int64;

DateUtils

 

function MilliSecondsBetween(const ANow, AThen: TDateTime): Int64;

DateUtils

 

function MilliSecondSpan(const ANow, AThen: TDateTime): Double;

DateUtils

 

function MinuteOf(const AValue: TDateTime): Word;

DateUtils

 

function MinuteOfTheDay(const AValue: TDateTime): Word;

DateUtils

 

function MinuteOfTheHour(const AValue: TDateTime): Word;

DateUtils

 

function MinuteOfTheMonth(const AValue: TDateTime): Word;

DateUtils

 

function MinuteOfTheWeek(const AValue: TDateTime): Word;

DateUtils

 

function MinuteOfTheYear(const AValue: TDateTime): LongWord;

DateUtils

 

function MinutesBetween(const ANow, AThen: TDateTime): Int64;

DateUtils

 

function MinuteSpan(const ANow, AThen: TDateTime): Double;

DateUtils

 

function MonthOf(const AValue: TDateTime): Word;

DateUtils

Returns the month of the year represented by a TDateTime value.

function MonthOfTheYear(const AValue: TDateTime): Word;

DateUtils

Returns the month of the year represented by a TDateTime value.

function MonthsBetween(const ANow, AThen: TDateTime): Integer;

DateUtils

Returns the approximate number of months between two specified TDateTime values.

function MonthSpan(const ANow, AThen: TDateTime): Double;

DateUtils

Returns the approximate number of months (including fractions thereof) between two specified TDateTime values.

const SecsPerDay;

SysUtils

Specifies the number of seconds per day.

const MSecsPerDay;

SysUtils

Specifies the number of milliseconds per day.

function MSecsToTimeStamp(MSecs: Comp): TTimeStamp;

SysUtils

Converts a specified number of milliseconds into a TTimeStamp value.

Function Now: TDateTime;

SysUtils

Returns the current date and time.

function NthDayOfWeek(const AValue: TDateTime): Word;

DateUtils

Returns which occurence of its weekday a specified TDateTime value represents.

NullSQLTimeStamp : TSQLTimeStamp= (Year: 0; Month: 0; Day: 0; Hour: 0; Minute: 0; Second: 0; Fractions: 0);

SqlTimSt

Represents a NULL TSQLTimeStamp value.

function RecodeDate(const AValue: TDateTime; const AYear, AMonth, ADay: Word): TDateTime;

DateUtils

Replaces the date portion of a specified TDateTime value.

function RecodeDateTime(const AValue: TDateTime; const AYear, AMonth, ADay, AHour, AMinute, ASecond, AMilliSecond: Word): TDateTime;

DateUtils

Selectively replaces parts of a specified TDateTime value.

function RecodeDay(const AValue: TDateTime; const ADay: Word): TDateTime;

DateUtils

Replaces the day of the month for a specified TDateTime value.

function RecodeHour(const AValue: TDateTime; const AHour: Word): TDateTime;

DateUtils

Replaces the hour of the day for a specified TDateTime value.

const RecodeLeaveFieldAsIs = High(Word);

DateUtils

Identifies a parameter to RecodeDateTime that should not be used.

function RecodeMilliSecond(const AValue: TDateTime; const AMilliSecond: Word): TDateTime;

DateUtils

Replaces the millisecond of the second for a specified TDateTime value.

function RecodeMinute(const AValue: TDateTime; const AMinute: Word): TDateTime;

DateUtils

Replaces the minute of the hour for a specified TDateTime value.

function RecodeMonth(const AValue: TDateTime; const AMonth: Word): TDateTime;

DateUtils

Replaces the month of the year for a specified TDateTime value.

function RecodeSecond(const AValue: TDateTime; const ASecond: Word): TDateTime;

DateUtils

Replaces the second of the minute for a specified TDateTime value.

function RecodeTime(const AValue: TDateTime; const AHour, AMinute, ASecond, AMilliSecond: Word): TDateTime;

DateUtils

Replaces the time portion of a specified TDateTime value.

function RecodeYear(const AValue: TDateTime; const AYear: Word): TDateTime;

DateUtils

Replaces the year for a specified TDateTime value.

Procedure ReplaceDate(var DateTime: TDateTime; const NewDate: TDateTime);

SysUtils

Replaces the date portion of a TDateTime value with a specified date.

procedure ReplaceTime(var DateTime: TDateTime; const NewTime: TDateTime);

SysUtils

Replaces the time portion of a TDateTime value with a specified time.

function SameDate(const A, B: TDateTime): Boolean;

DateUtils

Indicates whether two TDateTime values represent the same year, month, and day.

function SameDateTime(const A, B: TDateTime): Boolean;

DateUtils

Indicates whether two TDateTime values represent the same year, month, day, hour, minute, second, and millisecond.

function SameTime(const A, B: TDateTime): Boolean;

DateUtils

Indicates whether two TDateTime values represent the same time of day, ignoring the date portion.

function SecondOf(const AValue: TDateTime): Word;

DateUtils

 

function SecondOfTheDay(const AValue: TDateTime): LongWord;

DateUtils

 

function SecondOfTheHour(const AValue: TDateTime): Word;

DateUtils

 

function SecondOfTheMinute(const AValue: TDateTime): Word;

DateUtils

 

function SecondOfTheMonth(const AValue: TDateTime): LongWord;

DateUtils

 

function SecondOfTheWeek(const AValue: TDateTime): LongWord;

DateUtils

 

function SecondOfTheYear(const AValue: TDateTime): LongWord;

DateUtils

 

function SecondsBetween(const ANow, AThen: TDateTime): Int64;

DateUtils

 

function SecondSpan(const ANow, AThen: TDateTime): Double;

DateUtils

 

function SQLDayOfWeek(const DateTime: TSQLTimeStamp): Integer;

SqlTimSt

Indicates the day of the week when a specified TSQLTimeStamp value occurs.

function SQLTimeStampToDateTime(const DateTime: TSQLTimeStamp): TDateTime;

SqlTimSt

Converts a TSQLTimeStamp value to a TDateTime value.

function SQLTimeStampToStr(const Format: string; DateTime: TSQLTimeStamp): string;

SqlTimSt

Converts a TSQLTimeStamp value to a string.

function StartOfADay(const AYear, ADayOfYear: Word): TDateTime; overload;

function StartOfADay(const AYear, AMonth, ADay: Word): TDateTime; overload;

DateUtils

Returns a TDateTime value that represents 12:00:00:00 AM on a specified day.

function StartOfAMonth(const AYear, AMonth: Word): TDateTime;

DateUtils

Returns a TDateTime value that represents 12:00:00:00 AM on the first day of a specified month.

function StartOfAWeek(const AYear, AWeekOfYear: Word; const ADayOfWeek: Word = 1): TDateTime;

DateUtils

Returns a TDateTime value that represents 12:00:00:00 AM on a specified day of a specified week.

function StartOfAYear(const AYear): TDateTime;

DateUtils

Returns a TDateTime value that represents 12:00:00:00 AM on the first day of a specified year.

function StartOfTheDay(const AValue: TDateTime): TDateTime;

DateUtils

Returns a TDateTime value that represents 12:00:00:00 AM on the day identified by a specified TDateTime value.

function StartOfTheMonth(const AValue: TDateTime): TDateTime;

DateUtils

Returns a TDateTime value that represents 12:00:00:00 AM on the first day of the month identified by a specified TDateTime value.

function StartOfTheWeek(const AValue: TDateTime): TDateTime;

DateUtils

Returns a TDateTime value that represents 12:00:00:00 AM on the first day of the week identified by a specified TDateTime value.

function StartOfTheYear(const AValue: TDateTime): TDateTime;

DateUtils

Returns a TDateTime value that represents 12:00:00:00 AM on the first day of the year identified by a specified TDateTime value.

function StrToDate(const S: string): TDateTime;

SysUtils

Converts a string to a TDateTime value.

function StrToDateTime(const S: string): TDateTime;

SysUtils

Converts a string to a TDateTime value.

function StrToSQLTimeStamp(const S: string): TSQLTimeStamp;

SqlTimSt

Converts a string to a TSQLTimeStamp value.

function StrToTime(const S: string): TDateTime;

SysUtils

Converts a string to a TDateTime value.

function SystemTimeToDateTime(const SystemTime: TSystemTime): TDateTime;

SysUtils

Converts a TSystemTime value into a TDateTime value

function Time: TDateTime;

SysUtils

Returns the current time.

function TimeOf(const AValue: TDateTime): TDateTime;

DateUtils

Strips the date portion from a TDateTime value.

function TimeStampToDateTime(const TimeStamp: TTimeStamp): TDateTime;

SysUtils

Converts a TTimeStamp value into the corresponding TDateTime value.

function TimeStampToMSecs(const TimeStamp: TTimeStamp): Comp;

SysUtils

Converts a TTimeStamp value into an absolute number of milliseconds.

function TimeToStr(Time: TDateTime): string;

SysUtils

Returns a string that represents a TDateTime value.

function Today: TDateTime;

DateUtils

Returns a TDateTime value that represents the current date.

function Tomorrow: TDateTime;

DateUtils

Returns a TDateTime value that represents the following day.

function TryEncodeDateDay(const AYear, ADayOfYear: Word; out AValue: TDateTime): Boolean;

DateUtils

Calculates the TDateTime value that represents a specified day of the year for a specified year.

function TryEncodeDateMonthWeek(const AYear, AMonth, AWeekOfMonth, ADayOfWeek: Word; out AValue: TDateTime): Boolean;

DateUtils

Calculates the TDateTime value that represents a specified day of a specified week in a specified month and year.

function TryEncodeDateTime(const AYear, AMonth, ADay, AHour, AMinute, ASecond, AMilliSecond: Word; out AValue: TDateTime): Boolean;

DateUtils

Calculates the TDateTime value that represents a specified year, month, day, hour, minute, second, and millisecond.

function TryEncodeDateWeek(const AYear, AWeekOfYear: Word; out AValue: TDateTime; const ADayOfWeek: Word = 1): Boolean;

DateUtils

Calculates the TDateTime value that represents a specified day of a specified week in a specified year.

function TryEncodeDayOfWeekInMonth(const AYear, AMonth, ANthDayOfWeek, ADayOfWeek: Word, out AValue: TDateTime): Boolean;

DateUtils

Calculates a TDateTime value that represents a specified occurrence of a day of the week within a specified month and year.

function TryRecodeDateTime(const AValue: TDateTime; const AYear, AMonth, ADay, AHour, AMinute, ASecond, AMilliSecond: Word; out AResult: TDateTime): Boolean;

DateUtils

Selectively replaces parts of a specified TDateTime value.

function TryStrToSQLTimeStamp(const S: string; var TimeStamp: TSQLTimeStamp) : Boolean;

SqlTimSt

Converts a string to a TSQLTimeStamp value.

const UnixDateDelta = 25569;

SysUtils

Specifies the difference between TDateTime and TIME_T values.

function WeekOf(const AValue: TDateTime): Word;

DateUtils

Returns the week of the year represented by a TDateTime value.

function WeekOfTheMonth(const AValue: TDateTime): Word; overload;

function WeekOfTheMonth(const AValue: TDateTime; var AYear, AMonth: Word): Word; overload;

DateUtils

Returns the week of the month represented by a TDateTime value.

function WeekOfTheYear(const AValue: TDateTime): Word; overload;

function WeekOfTheYear(const AValue: TDateTime; var AYear): Word; overload;

DateUtils

Returns the week of the year represented by a TDateTime value.

function WeeksBetween(const ANow, AThen: TDateTime): Integer;

DateUtils

Returns the number of whole weeks between two specified TDateTime values.

function WeeksInAYear(const AYear: Word): Word;

DateUtils

Returns the number of weeks in a specified year.

function WeeksInYear(const AValue: TDateTime): Word;

DateUtils

Returns the number of weeks in the year of a specified TDateTime value.

function WeekSpan(const ANow, AThen: TDateTime): Double;

DateUtils

Returns the number of weeks (including fractional weeks) between two specified TDateTime values.

function WithinPastDays(const ANow, AThen: TDateTime; const ADays: Integer): Boolean;

DateUtils

Indicates whether two dates are within a specified number of days of each other.

function WithinPastHours(const ANow, AThen: TDateTime; const AHours: Int64): Boolean;

DateUtils

Indicates whether two date/time values are within a specified number of hours of each other.

function WithinPastMilliSeconds(const ANow, AThen: TDateTime; const AMilliSeconds: Int64): Boolean;

DateUtils

Indicates whether two date/time values are within a specified number of milliseconds of each other.

function WithinPastMinutes(const ANow, AThen: TDateTime; const AMinutes: Int64): Boolean;

DateUtils

Indicates whether two date/time values are within a specified number of minutes of each other.

function WithinPastMonths(const ANow, AThen: TDateTime; const AMonths: Integer): Boolean;

DateUtils

Indicates whether two date/time values are within a specified number of months of each other.

function WithinPastSeconds(const ANow, AThen: TDateTime; const ASeconds: Int64): Boolean;

DateUtils

Indicates whether two date/time values are within a specified number of seconds of each other.

function WithinPastWeeks(const ANow, AThen: TDateTime; const AWeeks: Integer): Boolean;

DateUtils

Indicates whether two date/time values are within a specified number of weeks of each other.

function WithinPastYears(const ANow, AThen: TDateTime; const AYears: Integer): Boolean;

DateUtils

Indicates whether two date/time values are within a specified number of years of each other.

function YearOf(const AValue: TDateTime): Word;

DateUtils

Returns the year represented by a TDateTime value.

function YearsBetween(const ANow, AThen: TDateTime): Integer;

DateUtils

Returns the approximate number of years between two specified TDateTime values.

function YearSpan(const ANow, AThen: TDateTime): Double;

DateUtils

Returns the approximate number of years (including fractions thereof) between two specified TDateTime values.

function Yesterday: TDateTime;

DateUtils

Returns a TDateTime value that represents the preceding day.

 

6.       Dialog and Message Routines

 

 

Updated on 26-5-2004

function CreateMessageDialog(const Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons): TForm;

Dialogs

Creates a specified message dialog

var ForceCurrentDirectory: Boolean

Dialogs

Indicates whether open and save dialogs should display the current directory if no initial directory is assigned

function InputBox(const ACaption, APrompt, ADefault: string): string;

Dialogs

Displays an input dialog box that enables the user to enter a string

function InputQuery(const ACaption, APrompt: string; var Value: string): Boolean;

Dialogs

Displays an input dialog that enables the user to enter a string

function IsAbortResult(const AModalResult: TModalResult): Boolean;

Controls

Checks the return value from a modal form dialog and indicates whether the user selected Abort or Cancel.

function IsAnAllResult(const AModalResult: TModalResult): Boolean;

Controls

Checks the return value from a modal form dialog and indicates whether the user selected All, Yes to All, or No to All.

function IsNegativeResult(const AModalResult: TModalResult): Boolean;

Controls

Checks the return value from a modal form dialog and indicates whether the user selected No or No to All.

function IsPositiveResult(const AModalResult: TModalResult): Boolean;

Controls

Checks the return value from a modal form dialog and indicates whether the user selected Ok, Yes, Yes to All, or All.

function LoginDialog(const ADatabaseName: string; var AUserName, APassword: string): Boolean;

Dblogdlg

Brings up the database Login dialog to allow the user to connect to a database server

function LoginDialogEx(const ADatabaseName: string; var AUserName, APassword: string; NameReadOnly: Boolean): Boolean;

Dblogdlg

Brings up the database Login dialog to allow the user to connect to a database server

function MessageDlg(const Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint): Word;

Dialogs

Displays a message dialog box in the center of the screen

function MessageDlgPos(const Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint; X, Y: Integer): Word;

Dialogs

Displays a message dialog box at the specified screen coordinates

function MessageDlgPosHelp(const Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint; X, Y: Integer; const HelpFileName: string): Word;

Dialogs

Displays a message dialog box whose help is supplied in a named help file

function PromptForFileName(var AFileName: string; const AFilter: string = ''; const ADefaultExt: string = ''; const ATitle: string = ''; const AInitialDir: string = ''; SaveDialog: Boolean = False): Boolean;

Dialogs

Displays an open or save dialog, where the user can specify a file name.

function RemoteLoginDialog(var AUserName, APassword: string): Boolean;

DBLog-

Dlb

Brings up the database Login dialog to allow the user to connect to a database server.

function SelectDirectory(const Caption: string; const Root: WideString; out Directory: string): Boolean; overload;

function SelectDirectory(var Directory: string; Options: TSelectDirOpts; HelpCtx: Longint): Boolean; overload;

FileCtrl

Brings up a dialog to allow the user to enter a directory name

procedure ShowMessage(const Msg: string);

Dialogs

Displays a message box with an OK button

procedure ShowMessageFmt(const Msg: string; Params: array of const);

Dialogs

Displays a message box with a formatted message

procedure ShowMessagePos(const Msg: string; X, Y: Integer);

Dialogs

Displays a message box at a specified location.

function StripAllFromResult(const AModalResult: TModalResult): TModalResult;

Controls

Converts a TModalResult value from a constant that refers to “all” to the corresponding simple constant.

 

7.       Dynamic Memory Allocation Routines

 

 

Checked on 27-5-2004

procedure Dispose(var P: Pointer);

System

Releases memory allocated for a dynamic variable

procedure Finalize( var V [; Count: Integer] );

System

Uninitializes a dynamically allocated variable.

procedure FreeMem(var P: Pointer[; Size: Integer]);

System

Disposes of a dynamic variable of a given size

procedure GetMem(var P: Pointer; Size: Integer);

System

Creates a dynamic variable and a pointer to the address of the block

procedure Initialize(var V [ ; Count: Integer ] );

System

Initializes a dynamically allocated variable

procedure New(var P: Pointer);

System

Creates a new dynamic variable and sets P to point to it

 

8.       Exception Handling Routines

 

 

Updated on 27-5-2004

function AcquireExceptionObject(X);

System

Allows an exception object to persist after the except clause exits.

procedure DatabaseError(const Message: string; Component: TComponent = nil);

Db

Creates and raises an EDatabaseError exception

procedure DatabaseErrorFmt(const Message: string; const Args: array of const; Component: TComponent = nil);

Db

Creates and raises an EDatabaseError exception with a formatted error message

var ErrorAddr: Pointer;

System

Contains the address of a statement causing a runtime error

var ErrorProc: Pointer;

System

Points to the RTL run-time error handler

function ExceptAddr: Pointer;

Sysutils

Returns the address at which the current exception was raised

function ExceptionErrorMessage(ExceptObject: TObject; ExceptAddr: Pointer; Buffer: PChar; Size: Integer): Integer;

SysUtils

Formats a standard error message.

function ExceptObject: TObject;

SysUtils

Returns a reference to the object associated with the current exception

var ExceptProc: Pointer;

System

Points to the lowest-level RTL exception handler

function GetLastError: Integer; stdcall;

System

Returns the last error reported by an operating system API call.

procedure OutOfMemoryError;

SysUtils

Raises an EOutOfMemory exception

procedure RaiseLastOSError;

SysUtils

Raises an exception for the last occurring OS or system library error.

procedure RaiseLastWin32Error;

SysUtils

Raises an exception for the last occurring Win32 error

function ReleaseExceptionObject(X);

System

Decrements the reference count on an exception object that was incremented by a call to AcquireExceptionObject.

function SetErrorProc(ErrorProc: TSocketErrorProc): TSocketErrorProc;

ScktComp

Replaces the exception handler for error messages that are received from a Windows socket connection

procedure ShowException(ExceptObject: TObject; ExceptAddr: Pointer);

SysUtils

Displays an exception message with its physical address

function SysErrorMessage(ErrorCode: Integer): string;

SysUtils

Converts Win32 API error codes into strings

function Win32Check(RetVal: BOOL): BOOL;

SysUtils

Checks the return value of a Windows API call and raises an appropriate exception when it indicates failure

 

9.       File Management Routines

 

 

Updated on 26-5-2004

procedure AssignFile(var F; FileName: string);

System

Associates the name of an external file with a file variable

procedure ChDir(S: string);

System

Changes the current directory

procedure CloseFile(var F);

System

Terminates the association between file variable and an external disk file (Delphi)

function CreateDir(const Dir: string): Boolean;

SysUtils

Creates a new directory

function DeleteFile(const FileName: string): Boolean;

SysUtils

Deletes a file from disk.

function DirectoryExists(Name: string): Boolean;

FileCtrl

Determines whether a specified directory exists

function DiskFree(Drive: Byte): Int64;

Sysutils

Returns the number of free bytes on a specified drive

function DiskSize(Drive: Byte): Int64;

SysUtils

Returns the size, in bytes, of a specified drive

const fmClosed // closed file

const fmInput  // reset file (TTextRec)

const fmOutput // rewritten file (TTextRec)

const fmInOut  // reset or rewritten file (TFileRec)

const fmCRLF   // DOS-style EoL and EoF markers (TTextRec)

const fmMask  // mask out fmCRLF flag (TTextRec)

SysUtils

File mode constants are used to open and close disk files

const fmOpenRead;
const fmOpenWrite;
const fmOpenReadWrite;
const fmShareCompat;
const fmShareExclusive;
const fmShareDenyWrite;
const fmShareDenyRead;
const fmShareDenyNone;

SysUtils

File open mode constants are used to control the access mode to a file or stream

function FileAge(const FileName: string): Integer;

SysUtils

Returns the OS timestamp of a file.

procedure FileClose(Handle: Integer);

SysUtils

Closes a specified file

function FileCreate(const FileName: string): Integer;

SysUtils

Creates a new file.

function FileDateToDateTime(FileDate: Integer): TDateTime;

SysUtils

Converts a DOS date-time value to TDateTime value

function FileExists(const FileName: string): Boolean;

SysUtils

Tests if a specified file exists

function FileGetAttr(const FileName: string): Integer;

SysUtils

Returns the file attributes of FileName

function FileGetDate(Handle: Integer): Integer;

SysUtils

Returns a DOS date-time stamp for a specified file

function FileIsReadOnly(const FileName: string): Boolean;

SysUtils

Report if file is read-only.

function FileOpen(const FileName: string; Mode: LongWord): Integer;

SysUtils

Opens a specified file using a specified access mode

function FileRead(Handle: Integer; var Buffer; Count: Integer): Integer;

SysUtils

Reads a specified number of bytes from a file

function FileSearch(const Name, DirList: string): string;

SysUtils

Searches a specified DOS path for a file

function FileSeek(Handle, Offset, Origin: Integer): Integer; overload;

SysUtils

Positions the current file pointer in a previously opened file

function FileSetAttr(const FileName: string; Attr: Integer): Integer;

SysUtils

Sets the file attributes of a specified file

function FileSetDate(Handle: Integer; Age: Integer): Integer;

SysUtils

Sets the DOS time stamp for a specified file

function FileWrite(Handle: Integer; const Buffer; Count: Integer): Integer;

SysUtils

Writes the contents of a buffer to the current position in a file

procedure FindClose(var F: TSearchRec);

SysUtils

Releases memory allocated by FindFirst

function FindFirst(const Path: string; Attr: Integer; var F: TSearchRec): Integer;

SysUtils

Searches for the first instance of a file name with a given set of attributes in a specified directory

function FindNext(var F: TSearchRec): Integer;

SysUtils

Returns the next entry matching the name and attributes specified in a previous call to FindFirst

function ForceDirectories(Dir: string): Boolean;

FileCtrl

Creates all the directories along a directory path if they do not already exist

function GetCurrentDir: string;

SysUtils

Returns the name of the current directory

procedure GetDir(D: Byte; var S: string);

System

Returns the current directory for a specified drive

function RemoveDir(const Dir: string): Boolean;

SysUtils

Deletes an existing empty directory

function RenameFile(const OldName, NewName: string): Boolean;

SysUtils

Changes a file name

function SetCurrentDir(const Dir: string): Boolean;

SysUtils

Sets the current directory

 

10.    File Name Utilities

 

 

Updated on 26-5-2004

function ChangeFileExt(const FileName, Extension: string): string;

SysUtils

Changes the extension of a file name

function ExcludeTrailingBackslash(const S: string): string;

SysUtils

Returns a path name after removing any '\' at the end

function ExcludeTrailingPathDelimiter(const S: string): string;

SysUtils

Returns a path name without a trailing delimiter.

function ExpandFileName(const FileName: string): string;

SysUtils

Returns the full path name for a relative file name

function ExpandUNCFileName(const FileName: string): string;

SysUtils

Returns the full path of a file name with the network drive portion in UNC format

function ExtractFileDir(const FileName: string): string;

SysUtils

Extracts the drive and directory parts from FileName

function ExtractFileDrive(const FileName: string): string;

SysUtils

Returns the drive portion of a file name

function ExtractFileExt(const FileName: string): string;

SysUtils

Returns the extension portions of a file name

function ExtractFileName(const FileName: string): string;

SysUtils

Extracts the name and extension parts of a file name

function ExtractFilePath(const FileName: string): string;

SysUtils

Returns the drive and directory portions of a file name

function ExtractRelativePath(const BaseName, DestName: string): string;

SysUtils

Returns a relative path name, relative to a specific base directory

function ExtractShortPathName(const FileName: string): string;

SysUtils

Converts a file name to the short 8.3 form

function IncludeTrailingBackslash(const S: string): string;

SysUtils

Returns a path name after adding a '\' to the end if it is not already there

function IncludeTrailingPathDelimiter(const S: string): string;

SysUtils

Ensures path name ends with delimiter.

function IsPathDelimiter(const S: string; Index: Integer): Boolean;

SysUtils

Indicates whether the byte at position Index of a string is the backslash character

function MatchesMask(const Filename, Mask: string): Boolean;

Masks

Indicates whether a file name conforms to the format specified by a filter string

function MinimizeName(const Filename: TFileName; Canvas: TCanvas; MaxLen: Integer): TFileName;

FileCtrl

Shortens a fully qualified path name so that it can be drawn with a specified length limit.

procedure ProcessPath (const EditText: string; var Drive: Char; var DirPart: string; var FilePart: string);

FileCtrl

Parses a file name into its constituent parts

 

11.    Floating Point Conversion Routines

 

 

Checked on 26-5-2004

function FloatToCurr(const Value: Extended): Currency;

SysUtils

Converts a floating-point value to a Currency value.

procedure FloatToDecimal(var DecVal: TFloatRec; const Value; ValueType: TFloatValue; Precision, Decimals: Integer);

SysUtils

Converts a floating-point value to a decimal representation

function FloatToStr(Value: Extended): string;

Sysutils

Converts a floating point value to a string

function FloatToStrF(Value: Extended; Format: TFloatFormat; Precision, Digits: Integer): string;

SysUtils

Converts a floating point value to a string, using a specified Format, Precision, and Digits

function FloatToText(Buffer: PChar; const Value; ValueType: TFloatValue; Format: TFloatFormat; Precision, Digits: Integer): Integer;

SysUtils

Converts a floating-point value to an unterminated character string, using a specified Format, Precision and Digits

function FloatToTextFmt(Buffer: PChar; const Value; ValueType: TFloatValue; Format: PChar): Integer;

SysUtils

Converts a floating-point value to to an unterminated character string, using a specified format

function FormatFloat(const Format: string; Value: Extended): string;

SysUtils

Formats a floating point value

function StrToCurr(const S: string): Currency;

SysUtils

Converts a string to a Currency value

function StrToFloat(const S: string): Extended;

SysUtils

Converts a given string to a floating-point value

function TextToFloat(Buffer: PChar; var Value; ValueType: TFloatValue): Boolean;

SysUtils

Returns a floating-point value from a null-terminated string

 

12.    Flow Control Routines

 

 

Checked on 26-5-2004

procedure Abort;

SysUtils

Ends the current process without reporting an error

procedure Break;

System

Causes the flow of control to exit a for, while, or repeat statement

procedure Continue;

System

Allows the flow of control to proceed to the next iteration of for, while, or repeat statements

procedure Exit;

System

Exits from the current procedure

procedure Halt [ ( Exitcode: Integer) ];

System

Initiates abnormal termination of a program

procedure RunError [ ( Errorcode: Byte ) ];

System

Stops execution and generates a run-time error

 

13.    File I/O Procedures

 

 

Updated on 27-5-2004

procedure Append(var F: Text);

System

Prepares an existing file for adding text to the end

procedure BlockRead(var F: File; var Buf; Count: Integer [; var AmtTransferred: Integer]);

System

Reads one or more records from an open file into a variable

procedure BlockWrite(var f: File; var Buf; Count: Integer [; var AmtTransferred: Integer]);

System

Writes one or more records from a variable to an open file

function Eof(var F): Boolean;

System

Tests whether the file position is at the end of a file

var ErrOutput: Text;

System

Specifies a write-only file associated with stderr, usually the display.

var FileMode: Byte;

System

Indicates the access mode on typed and untyped files opened by the Reset class

function FilePos(var F): Longint;

System

Returns the current file position

function FileSize(var F): Integer;

System

Returns the size of a file in bytes or the number of records in a record file

var Input: Text;

System

Specifies a read-only file associated with an operating system's standard input device.

function IOResult: Integer;

System

Returns the status of the last File I/O operation performed

var Input: Text;

System

Specifies a read-only file associated with an operating system's standard input device

procedure MkDir(S: string);

System

Creates a new subdirectory

var Output: Text;

System

Specifies a write-only file associated with standard output, usually the display

procedure Rename(var F; Newname:string); procedure Rename(var F; Newname:PChar);

System

Changes the name of an external file

procedure Reset(var F [: File; RecSize: Word ] );

System

Opens an existing file

procedure Rewrite(var F: File [; Recsize: Word ] );

System

Creates a new file and opens it

procedure RmDir(S: string);

System

Deletes an empty subdirectory

procedure Seek(var F; N: Longint);

System

Moves the current position of a file to a specified component

procedure Truncate(var F);

System

Deletes all the records after the current file position

procedure Write(F, V1,...,Vn);

System

Writes to a typed file

 

14.    Measurement Conversion Routines

 

 

Updated on 27-5-2004

var

  auSquareMillimeters: TConvType;

  auSquareCentimeters: TConvType;

  auSquareDecimeters: TConvType;

  auSquareMeters: TConvType;

  auSquareDecameters: TConvType;

  auSquareHectometers: TConvType;

 

  auSquareKilometers: TConvType;

  auSquareInches: TConvType;

  auSquareFeet: TConvType;

  auSquareYards: TConvType;

  auSquareMiles: TConvType;

  auAcres: TConvType;

 

  auCentares: TConvType;

  auAres: TConvType;

  auHectares: TConvType;

  auSquareRods: TConvType;

StdConvs

Represent units that measure area

function CelsiusToFahrenheit(const AValue: Double): Double;

StdConvs

Converts a temperature expressed in degrees Celsius to the corresponding temperature in degrees Fahrenheit.

function CompatibleConversionType(const AType: TConvType; const AFamily: TConvFamily): Boolean;

ConvUtils

Indicates whether a specified conversion type is registered with a specified conversion family.

function CompatibleConversionTypes(const AFrom, ATo: TConvType): Boolean;

ConvUtils

Indicates whether the Convert function can convert between two specified conversion types.

var

  cbArea: TConvFamily;

  cbDistance: TConvFamily;

  cbMass: TConvFamily;

  cbTemperature: TConvFamily;

  cbTime: TConvFamily;

  cbVolume: TConvFamily;

StdConvs

Represent a family of measurement units.

function Convert(const AValue: Double; const AFrom, ATo: TConvType): Double; overload;

function Convert(const AValue: Double; const AFrom1, AFrom2, ATo1, ATo2: TConvType): Double; overload;

ConvUtils

Converts a measurement from one set of units to another.

function ConvertFrom(const AFrom: TConvType; const AValue: Double): Double;

ConvUtils

Converts a measurement from the specified units to the base units of its conversion family.

function ConvertTo(const AValue: Double; const ATo: TConvType): Double;

ConvUtils

Converts a measurement from the base units of a conversion family into a specified conversion type.

function ConvFamilyToDescription(const AFamily: TConvFamily: string;

ConvUtils

Returns the string description of what a conversion family measures.

function ConvTypeToDescription(const AType: TConvType: string;

ConvUtils

Returns the string description of a conversion type (measurement unit).

function ConvTypeToFamily(const AType: TConvType): TConvFamily; overload;

function ConvTypeToFamily(const AFrom, ATo: TConvType): TConvFamily; overload;

ConvUtils

Returns the identifier for the conversion family with which a conversion type or pair of types is registered.

function ConvUnitAdd(const AValue1: Double; const AType1: TConvType; const AValue2: Double; const AType2, AResultType: TConvType): Double;

ConvUtils

Adds two measurements and returns the result using a specified unit of measurement.

function ConvUnitCompareValue(const AValue1: Double; const AType1: TConvType; const AValue2: Double; const AType2: TConvType): TValueRelationship;

ConvUtils

Indicates the relationship between two measurements.

function ConvUnitDec(const AValue: Double; const AType: TConvType; const AAmount: Double; const AAmountType: TConvType): Double; overload;

function ConvUnitDec(const AValue: Double; const AType, AAmountType: TConvType): Double; overload;

ConvUtils

Decrements a specified measurement by a specified amount.

function ConvUnitDiff(const AValue1: Double; const AType1: TConvType; const AValue2: Double; const AType2, AResultType: TConvType): Double;

ConvUtils

Subtracts one measurement from another and returns the result using a specified unit of measurement.

function ConvUnitInc(const AValue: Double; const AType: TConvType; const AAmount: Double, const AAmountType: TConvType): Double; overload;

function ConvUnitInc(const AValue: Double; const AType, AAmountType: TConvType): Double; overload;

ConvUtils

Increments a specified measurement by a specified amount.

function ConvUnitSameValue(const AValue1: Double; const AType1: TConvType; const AValue2: Double; const AType2: TConvType): Boolean;

ConvUtils

Indicates whether two measurements are equivalent.

function ConvUnitToStr(const AValue: Double; const AType: TConvType ): string;

ConvUtils

Formats a measurement and its conversion unit into a human-readable string.

function ConvUnitWithinNext(const AValue, ATest: Double; const AType: TConvType; const AAmount: Double; const AAmountType: TConvType): Boolean;

ConvUtils

Indicates whether a specified measurement exceeds another measurement by at most a specified amount.

function ConvUnitWithinPrevious(const AValue, ATest: Double; const AType: TConvType; const AAmount: Double; const AAmountType: TConvType): Boolean;

ConvUtils

Indicates whether a specified measurement is at most a specified amount less than another measurement.

function CycleToDeg(const Cycles: Extended): Extended;

Math

Converts an angle measurement from cycles to degrees.

function CycleToGrad(const Cycles: Extended): Extended;

Math

Converts an angle measurement from cycles to grads.

function CycleToRad(Cycles: Extended): Extended;

Math

Converts an angle measurement from cycles to radians

function DateTimeToJulianDate(const AValue: TDateTime ): Double;

DateUtils

Converts a TDateTime value into a Julian date.

function DateTimeToModifiedJulianDate(const AValue: TDateTime): Double;

DateUtils

Converts a TDateTime value into a modified Julian date.

function DateTimeToUnix(const AValue: TDateTime ): Int64;

DateUtils

Converts a TDateTime value into a Unix-based date-and-time value.

function DegToCycle(const Degrees: Extended): Extended;

Math

Returns the value of a degree measurement expressed in cycles.

function DegToGrad(const Degrees: Extended): Extended;

Math

Returns the value of a degree measurement expressed in grads.

function DegToRad(Degrees: Extended): Extended;

Math

Returns the value of a degree measurement expressed in radians

function DescriptionToConvFamily(const ADescription: string; out AFamily: TConvFamily): Boolean;

ConvUtils

Retrieves the identifier for a conversion family given its name.

function DescriptionToConvType(const AFamily, TConvFamily; const ADescription: string; out AType: TConvType): Boolean; overload;

function DescriptionToConvType(const ADescription: string; out AType: TConvType): Boolean; overload;

ConvUtils

Retrieves the identifier for a conversion type given its name and family.

var

  duMicromicrons: TConvType;

  duAngstroms: TConvType;

  duMillimicrons: TConvType

  duMicrons: TConvType;

  duMillimeters: TConvType;

  duCentimeters: TConvType;

 

  duDecimeters: TConvType;

  duMeters: TConvType;

  duDecameters: TConvType;

  duHectometers: TConvType;

  duKilometers: TConvType;

  duMegameters: TConvType;

 

  duGigameters: TConvType;

  duInches: TConvType;

  duFeet: TConvType;

  duYards: TConvType;

  duMiles: TConvType;

  duNauticalMiles: TConvType

  duAstronomicalUnits: TConvType

 

  duLightYears: TConvType;

  duParsecs: TConvType;

  duCubits: TConvType;

  duFathoms: TConvType;

  duFurlongs: TConvType;

  duHands: TConvType;

  duPaces: TConvType;

 

  duRods: TConvType;

  duChains: TConvType;

  duLinks: TConvType;

  duPicas: TConvType;

  duPoints: TConvType;

StdConvs

Represent units that measure distance.

function FahrenheitToCelsius(const AValue: Double): Double;

StdConvs

Converts a temperature expressed in degrees Fahrenheit to the corresponding temperature in degrees Celsius.

procedure GetConvFamilies(out AFamilies: TConvFamilyArray);

ConvUtils

Returns a list of all registered conversion families.

procedure GetConvTypes(const AFamily: TConvFamily; out ATypes: TConvTypeArray);

ConvUtils

Returns a list of all registered conversion types in a specified conversion family.

function GradToCycle(const Grads: Extended): Extended;

Math

Converts grad measurements to cycles.

function GradToDeg(const Grads: Extended): Extended;

Math

Converts grad measurements to degrees.

function GradToRad(Grads: Extended): Extended;

Math

Converts grad measurements to radians

function JulianDateToDateTime(const AValue: Double): TDateTime;

DateUtils

Converts a Julian date to a TDateTime value.

var

  muNanograms: TConvType;

  muMicrograms: TConvType;

  muMilligrams: TConvType

  muCentigrams: TConvType;

  muDecigrams: TConvType;

  muGrams: TConvType;

  muDecagrams: TConvType

 

  muHectograms: TConvType;

  muKilograms: TConvType;

  muMetricTons: TConvType;

  muDrams: TConvType

  muGrains: TConvType;

  muLongTons: TConvType

  muTons: TConvType;

 

  muOunces: TConvType

  muPounds: TConvType;

  muStones: TConvType

StdConvs

Represent units that measure weight.

function ModifiedJulianDateToDateTime(const AValue: Double): TDateTime;

DateUtils

Converts a modified Julian date to a TDateTime value.

function RadToCycle(Radians: Extended): Extended;

Math

Converts radians to cycles

function RadToDeg(Radians: Extended): Extended;

Math

Converts radians to degrees

function RadToGrad(Radians: Extended): Extended;

Math

Converts radians to grads

procedure RaiseConversionError(const AText: string; const AArgs: array of const); overload;

procedure RaiseConversionError(const AText: string); overload;

ConvUtils

Raises an EConversionError exception.

function RegisterConversionFamily(const ADescription: string): TConvFamily;

ConvUtils

Registers a new conversion family and returns its identifier.

function RegisterConversionType(const AFamily: TConvFamily; const ADescription: string, const AFactor: Double): TConvType; overload;

function RegisterConversionType(const AFamily: TConvFamily; const ADescription: string, const AToCommonProc, AFromCommonProc: TConversionProc): TConvType; overload;

function RegisterConversionType(AConvTypeInfo: TConvTypeInfo; out AType: TConvType): Boolean; overload;

ConvUtils

Registers a new conversion type and returns its identifier.

function StrToConvUnit(AText: string; out AType: TConvType): Double;

ConvUtils

Parses a string into a value and conversion type.

var

  tuCelsius: TConvType;

  tuKelvin: TConvType;

  tuFahrenheit: TConvType;

  tuRankine: TConvType;

  tuReamur: TConvType;

StdConvs

Represent units that measure temperature.

var

  tuMilliSeconds: TConvType;

  tuSeconds: TConvType;

  tuMinutes: TConvType;

  tuHours: TConvType;

  tuDays: TConvType;

  tuWeeks: TConvType;

  tuFortnights: TConvType;

 

  tuMonths: TConvType;

  tuYears: TConvType;

  tuDecades: TConvType;

  tuCenturies: TConvType;

  tuMillennia: TConvType;

  tuDateTime: TConvType;

  tuJulianDate: TConvType;

 

  tuModifiedJulianData: TConvType;

StdConvs

Represent units that measure time.

function TryConvTypeToFamily(const AType: TConvType); out AFamily: TConvFamily) : Boolean; overload;

function TryConvTypeToFamily(const AFrom, ATo: TConvType; out AFamily: TConvFamily) : Boolean; overload;

ConvUtils

Retrieves the identifier for the conversion family with which a conversion type or pair of types is registered.

function TryJulianDateToDateTime(const AValue: Double; out ADateTime: TDateTime): Boolean;

DateUtils

Converts a Julian date to a TDateTime value.

function tryModifiedJulianDateToDateTime(const AValue: Double; out ADateTime: TDateTime): Boolean;

DateUtils

Converts a modified Julian date to a TDateTime value.

function TryStrToConvUnit(AText: string; out AValue: Double; out AType: TConvType): Boolean;

ConvUtils

Parses a string into a value and conversion type.

function UnixToDateTime(const AValue: Int64): TDateTime;

DateUtils

Converts a Unix-based date-and-time value to a TDateTime value.

procedure UnregisterConversionFamily(const AFamily: TConvFamily);

ConvUtils

Unregisters a conversion family previously registered using RegisterConversionFamily.

procedure UnregisterConversionType(const AType: TConvType);

ConvUtils

Unregisters a conversion type previously registered using RegisterConversionType.

var

  vuCubicMillimeters: TConvType;

  vuCubicCentimeters: TConvType;

  vuCubicDecimeters: TConvType;

  vuCubicMeters: TConvType;

  vuCubicDecameters: TConvType;

  vuCubicHectometers: TConvType;

 

  vuCubicKilometers: TConvType;

  vuCubicInches: TConvType;

  vuCubicFeet: TConvType;

  vuCubicYards: TConvType;

  vuCubicMiles: TConvType;

  vuMilliLiters: TConvType;

 

  vuCentiLiters: TConvType;

  vuDeciLiters: TConvType;

  vuLiters: TConvType;

  vuDecaLiters: TConvType;

  vuHectoLiters: TConvType;

  vuKiloLiters: TConvType;

 

  vuAcreFeet: TConvType;

  vuAcreInches: TConvType;

  vuCords: TConvType;

  vuCordFeet: TConvType;

  vuDecisteres: TConvType;

  vuSteres: TConvType;

  vuDecasteres: TConvType;

 

  vuFluidGallons: TConvType;

  vuFluidQuarts: TConvType;

  vuFluidPints: TConvType;

  vuFluidCups: TConvType;

  vuFluidGills: TConvType;

  vuFluidOunces: TConvType;

 

  vuFluidTablespoons: TConvType;

  vuFluidTeaspoons: TConvType;

  vuDryGallons: TConvType;

  vuDryQuarts: TConvType;

  vuDryPints: TConvType;

  vuDryPecks: TConvType;

 

  vuDryBuckets: TConvType;

  vuDryBushels: TConvType;

  vuUKGallons: TConvType;

  vuUKPottles: TConvType;

  vuUKQuarts: TConvType;

  vuUKPints: TConvType;

  vuUKGills: TConvType;

 

  vuUKOunces: TConvType;

  vuUKPecks: TConvType;

  vuUKBuckets: TConvType;

  vuUKBushels: TConvType;

StdConvs

Represent units that measure distance.

 

15.    Memory Management Routines

 

 

Checked on 27-5-2004

function AllocMem(Size: Cardinal): Pointer;

SysUtils

Allocates a memory block and initializes each byte to zero

var AllocMemCount: Integer;

System

Represents the total number of allocated memory blocks in an application

var AllocMemSize: Integer;

System

Represents the total size of allocated memory blocks

function GetHeapStatus: THeapStatus;

System
ShareMem

Returns the current status of the memory manager

procedure GetMemoryManager(var MemMgr: TMemoryManager);

System

Returns the entry points of the currently installed memory manager

var HeapAllocFlags: Word;

System

Flags that indicate how the memory manager obtains memory from the operating system

function IsMemoryManagerSet:Boolean;

System

Indicates whether the memory manager has been overridden using the SetMemoryManager procedure

procedure ReallocMem(var P: Pointer; Size: Integer);

System

Reallocates a dynamic variable

procedure SetMemoryManager(const MemMgr: TMemoryManager);

System

Sets entry points of the memory manager

function SysFreeMem(P: Pointer): Integer;

System
ShareMem

Frees the memory pointed to by a specified pointer

function SysGetMem(Size: Integer): Pointer;

System
ShareMem

Allocates a specified number of bytes and returns a pointer to them

function SysReallocMem(P: Pointer; Size: Integer): Pointer;

System
ShareMem

Returns a pointer to a specified number of bytes, preserving the values pointed to by the Pointer parameter

 

16.    Minimum and Maximum values

 

 

Created on 27-5-2004

const MaxComp

Math

 

const MaxDouble

Math

 

const MaxExtended

Math

 

const MaxInt

System

 

const MaxLongint

System

 

const MaxSingle

Math

 

const MinComp

Math

 

const MinDouble

Math

 

const MinExtended

Math

 

const MinSingle

Math

 

 

17.    Miscellaneous Routines

 

 

Checked on 27-5-2004

procedure Assert(expr : Boolean [; const msg: string]);

System

Tests whether a boolean expression is successful

var AssertErrorProc: Pointer;

System

Points to the assertion error-handler.

function Assigned(var P): Boolean;

System

Tests for a nil (unassigned) pointer or procedural variable

procedure Beep;

SysUtils

Generates a standard beep using the computer speaker

function CountGenerations(Ancestor, Descendant: TClass): Integer;

Classes

Returns the number of intermediate classes between a derived class and its ancestor.

var DefaultTextLineBreakStyle: TTextLineBreakStyle;

System

Specifies the characters that are used by default to separate lines in text.

var DLLProc: Pointer;

System

Points to a procedure invoked by a DLL entry point

function FormatMaskText(const EditMask: string; const Value: string): string;

Mask

Returns a string formatted using an edit mask

procedure FreeAndNil(var Obj);

SysUtils

Frees an object reference and replaces the reference with nil

GetEnvironmentVariable(Name: string): string;

SysUtils

Returns environment variable value.

function Hi(X): Byte;

System

Returns the high-order byte of X as an unsigned value

function High(X);

System

Returns the highest value in the range of an argument

function HtmlTable(DataSet: TDataSet; DataSetHandler: TDSTableProducer; MaxRows: Integer): string;

DbWeb

Generates the HTML image of a dataset, using the properties and events of a table producer object

function IfThen(AValue: Boolean; const ATrue: Integer; const AFalse: Integer = 0): Integer; overload;

function IfThen(AValue: Boolean; const ATrue: Int64; const AFalse: Int64 = 0): Int64; overload;

function IfThen(AValue: Boolean; const ATrue: Double; const

 AFalse: Double = 0.0): Double; overload;

function IfThen(AValue: Boolean; const ATrue: string; const

 AFalse: string = ''): string; overload;

Math

StrUtils

Conditionally returns one of two specified values.

function IsAccel(VK: Word; const Str: string): Boolean;

Forms

Indicates whether a particular character is an accelerator character (or hot key) within a given menu caption or other text string

function IsValidIdent(const Ident: string): Boolean;

SysUtils

Tests for a valid Pascal identifier

function Lo(X): Byte;

System

Returns the low order Byte of argument X

function Low(X);

System

Returns the lowest value in a range

procedure Move(const Source; var Dest; Count: Integer);

System

Copies bytes from a source to a destination

function SizeOf(X): Integer;

System

Returns the number of bytes occupied by a variable or type

function Slice(var A: array; Count: Integer): array;

System

Returns a sub-section of an array

procedure UniqueString(var S: string);

System

Ensures that a given string has a reference count of one

function ValidParentForm(Control: TControl): TCustomForm;

Forms

Returns the form or property page that contains a specified control

 

18.    Numeric Formatting Routines

 

 

Checked on 27-5-2004

function CurrToStr(Value: Currency): string;

SysUtils

Formats a Currency value as a string

function CurrToStrF(Value: Currency; Format: TFloatFormat; Digits: Integer): string;

SysUtils

Converts a Currency value to a string, using a specified format

function DoubleToComp(adouble: Double; var result: Comp);

System

Converts a Double value to a Comp

function FormatCurr(const Format: string; Value: Currency): string;

SysUtils

Formats a Currency object

function IntToHex(Value: Integer; Digits: Integer): string; overload;

SysUtils

Returns the hex representation of an integer

function IntToStr(Value: Integer): string; overload;

SysUtils

Converts an integer to a string

 

19.    Ordinal Routines

 

 

Checked on 27-5-2004

procedure Dec(var X[ ; N: Longint]);

System

Decrements a variable by 1 or N

procedure Inc(var X [ ; N: Longint ] );

System

Increments an ordinal value by one or N

function Odd(X: Longint): Boolean;

System

Returns True if argument is an odd number

function Ord(X): Longint;

System

Returns the ordinal value of an ordinal-type expression

function Pred(X);

System

Returns the predecessor of the argument

function Succ(X);

System

Returns the successor of an argument

 

20.    Printer Support

 

 

Created on 27-5-2004

function Printer: TPrinter;

Printers

Returns a global instance of TPrinter to manage interaction with the printer.

function SetPrinter(NewPrinter: TPrinter): TPrinter;

Printers

Replaces the global instance of TPrinter that manages interaction with the printer.

 

21.    Pointer and Address Routines

 

 

Updated on 27-5-2004

function Addr(X): Pointer;

System

Returns a pointer to a specified object

procedure FreeAndNil(var Obj);

SysUtils

Frees an object reference and replaces the reference with nil.

function Ptr(Address: Integer): Pointer;

System

Converts a specified address to a pointer

 

22.    Random Number Routines

 

 

Updated on 27-5-2004

function RandG(Mean, StdDev: Extended): Extended;

Math

Generates random numbers with Gaussian distribution

function Random [ ( Range: Integer) ];

System

Generates random numbers within a specified range

function RandomFrom(const AValues: array of Double): Double; overload;

function RandomFrom(const AValues: array of Integer): Integer; overload;

function RandomFrom(const AValues: array of Int64): Int64; overload;

function RandomFrom(const AValues: array ofstring): string; overload;

Math

StrUtils

Returns a randomly selected element from an array.

procedure Randomize;

System

Initializes the random number generator with a random value

function RandomRange(const AFrom, ATo: Integer): Integer;

Math

Returns a random integer from a specified range.

var RandSeed: LongInt;

System

RandSeed stores the built-in random number generator's seed

 

 

 

 

23.    Set Handling Routines

 

 

Checked on 27-5-2004

procedure Exclude(var S: set of T;I:T);

System

Removes an element from a set

procedure Include(var S: set of T; I:T);

System

Adds an element to a set

 

24.    String Formatting Routines

 

 

Checked on 27-5-2004

function FmtLoadStr(Ident: Integer; const Args: array of const): string;

SysUtils

Returns formatted output using a resourced format string

procedure FmtStr(var StrResult: string; const Format: string; const Args: array of const);

SysUtils

Assembles a formatted string using a format string and an array of arguments

function Format(const Format: string; const Args: array of const): string;

SysUtils

Returns a formatted string assembled from a format string and an array of arguments

function FormatBuf(var Buffer; BufLen: Cardinal; const Format; FmtLen: Cardinal; const Args: array of const): Cardinal;

SysUtils

Formats the arguments from an array, placing the result in a buffer

procedure GetFormatSettings;

SysUtils

Resets the date and number format parameters to default values

function StrFmt(Buffer, Format: PChar; const Args: array of const): PChar;

SysUtils

Formats entries in an array

function StrLFmt(Buffer: PChar; MaxLen: Cardinal; Format: PChar; const Args: array of const): PChar;

SysUtils

Formats a series of arguments from a specified open array into a buffer

function WideFormat(const Format: WideString; const Args: arrayofconst): WideString;

SysUtils

Formats the series of arguments in the open array Args.

function WideFormatBuf(var Buffer; BufLen: Cardinal; const Format; FmtLen: Cardinal; const Args: arrayofconst): Cardinal;

 

Formats the series of arguments in the open array Args.

 

25.    String Handling Routines

 

 

Updated 24-5-2004

function AdjustLineBreaks(const S: string): string;

SysUtils

Standardizes line break characters to CR/LF

function AnsiCompareStr(const S1, S2: string): Integer;

SysUtils

Compares strings based on the current Windows locale with case sensitivity

function AnsiCompareText(const S1, S2: string): Integer;

SysUtils

Compares strings based on the current Windows locale without case sensitivity

function AnsiContainsStr(const AText,  SubText: string): Boolean;

StrUtils

Indicates whether one string is a (case-sensitive) substring of another.

function AnsiContainsText(const AText, ASubText: string): Boolean;

StrUtils

Indicates whether one string is a (case-insensitive) substring of another.

function AnsiDequotedStr(const S: string; AQuote: Char): string;

SysUtils

Converts a quoted string into an unquoted one.

function AnsiEndsStr(const ASubText, AText: string): Boolean;

StrUtils

Indicates whether one string is a (case-sensitive) suffix of another.

function AnsiEndsText(const ASubText, AText: string): Boolean;

StrUtils

Indicates whether one string is a (case-insensitive) suffix of another.

function AnsiExtractQuotedStr(var Src: PChar; Quote: Char): string;

SysUtils

Converts a quoted string into an unquoted string

function AnsiIndexStr(const AText: string; const AValues: array of string): Integer;

StrUtils

Provides the index of a specified string in an array of strings.

function AnsiIndexText(const AText: string; const AValues: array of string): Integer;

StrUtils

Provides the index of a specified string in an array of strings.

function AnsiLowerCase(const S: string): string;

SysUtils

Returns a string that is a copy of the given string converted to lower case

function AnsiMatchStr(const AText: string; const AValues: array of string): Integer;

StrUtils

Indicates whether an array of strings contains an exact match to a specified string.

function AnsiMatchText(const AText: string; const AValues: array of string): Boolean;

StrUtils

Indicates whether an array of strings contains a case-insensitive match to a specified string.

function AnsiPos(const Substr, S: string): Integer;

SysUtils

Locates the position of a sub-string within a string

function AnsiQuotedStr(const S: string; Quote: Char): string;

SysUtils

Returns the quoted version of a string

function AnsiReplaceStr(const AText, AFromText, AToText: string): string;

StrUtils

Replaces all occurrences of a substring with another string.

function AnsiReplaceText(const AText, AFromText, AToText: string): string;

StrUtils

Replaces all case-insensitive matches of a substring with another string.

var AnsiResemblesProc: TCompareTextProc = SoundExProc;

StrUtils

Controls the algorithm used by AnsiResemblesText to determine when two strings are similar.

function AnsiResemblesText(const AText, AOther: string): Boolean;

StrUtils

Indicates whether two strings are similar.

function AnsiSameStr(const S1, S2: string): Boolean;

SysUtils

Compares strings based on the current Windows locale with case sensitivity

function AnsiSameText(const S1, S2: string): Boolean;

Sysutils

Compares strings based on the current Windows locale without case sensitivity

function AnsiStartsStr(const ASubText, AText: string): Boolean;

StrUtils

Indicates whether one string is a (case-sensitive) prefix of another.

function AnsiStartsText(const ASubText, AText: string): Boolean;

StrUtils

Indicates whether one string is a (case-insensitive) prefix of another.

function AnsiUpperCase(const S: string): string;

SysUtils

Converts a string to upper case

function CompareStr(const S1, S2: string): Integer;

SysUtils

Compares two strings case sensitively

function CompareText(const S1, S2: string): Integer;

SysUtils

Compares two strings by ordinal value without case sensitivity

function Concat(s1 [, s2,..., sn]: string): string;

System

Concatenates two or more strings into one

function Copy(S; Index, Count: Integer): string;
function Copy(S; Index, Count: Integer): array;

System

Returns a substring of a string or a segment of a dynamic array

function DecodeSoundExInt(AValue: Integer): string;

StrUtils

Converts an integer representation of a SoundEx encoding into the corresponding phonetic string.

function DecodeSoundExWord(AValue: Word): string;

StrUtils

Converts a Word representation of a SoundEx encoding into the corresponding phonetic string.

procedure Delete(var S: string; Index, Count:Integer);

System

Removes a substring from a s string

function DupeString(const AText: string; ACount: Integer): string;

StrUtils

Returns the concatenation of a string with itself a specified number of repeats.

procedure Insert(Source: string; var S: string; Index: Integer);

System

Inserts a substring into a string beginning at a specified point

function IsDelimiter(const Delimiters, S: string; Index: Integer): Boolean;

SysUtils

Indicates whether a specified character in a string matches one of a set of delimiters

function LastDelimiter(const Delimiters, S: string): Integer;

SysUtils

Returns the byte index in S of the last character that matches any character in the Delimiters AnsiString

function LeftStr(const AText: string; ACount: Integer): string;

StrUtils

Returns the substring of a specified length that appears at the start of a string.

function Length(S): Integer;

System

Returns the number of characters in a string or elements in an array

function LowerCase(const S: string): string;

SysUtils

Converts an ASCII string to lowercase

function MidStr(const AText: string; const AStart, ACount: Integer): string;

StrUtils

Returns the substring of a specified length that appears at a specified position in a string.

const NullStr: PString;

SysUtils

Declares a pointer to EmptyStr

function Pos(Substr: string; S: string): Integer;

System

Returns the index value of the first character in a specified substring that occurs in a given string

function QuotedStr(const S: string): string;

SysUtils

Returns the quoted version of a string

function ReverseString(const AText: string): string;

StrUtils

Returns the reverse of a specified string.

function RightStr(const AText: string; ACount: Integer): string;

StrUtils

Returns the substring of a specified length that appears at the end of a string.

function SameText(const S1, S2: string): Boolean;

StrUtils

Compares two strings by ordinal value without case sensitivity.

procedure SetLength(var S; NewLength: Integer);

System

Sets the length of a string or dynamic-array variable

procedure SetString(var s: string; buffer: PChar; len: Integer);

System

Sets the contents and length of the given string

function SoundEx(const AText: string; ALength: TSoundExLength  = 4): string;

StrUtils

Converts a string into its SoundEx representation.

function SoundExCompare(const AText, AOther: string; ALength: TSoundExLength = 4): Integer;

StrUtils

Compares the SoundEx representations of two strings.

function SoundExInt(const AText: string; ALength: TSoundExIntLength = 4): Integer;

StrUtils

Converts a string into an integer that represents its phonetic value.

function SoundExProc(const AText, AOther: string): Boolean;

StrUtils

Indicates whether two strings are similar.

function SoundExSimilar(const AText, AOther: string; ALength: TSoundExLength = 4): Boolean;

StrUtils

Indicates whether two strings are similar.

function SoundExWord(const AText: string): Word;

StrUtils

Converts a string into a Word that represents its phonetic value.

procedure Str(X [: Width [: Decimals ]]; var S);

System

Formats a string and returns it to a variable

function StringOfChar(Ch: Char; Count: Integer): string;

System

Returns a string with a specified number of repeating characters

function StringReplace(const S, OldPattern, NewPattern: string; Flags: TReplaceFlags): string;

SysUtils

Returns a string with occurrences of one substring replaced by another substring

function StuffString(const AText: string; AStart, ALength: Cardinal; const ASubText: string): string;

StrUtils

Inserts a substring into a specified position of a string, replacing the current characters.

function Trim(const S: string): string;

SysUtils

Trims leading and trailing spaces and control characters from a string

function TrimLeft(const S: string): string;

SysUtils

Trims leading spaces and control characters from a string

function TrimRight(const S: string): string;

SysUtils

Trims trailing spaces and control characters from a string

function UpperCase(const S: string): string;

SysUtils

Returns a copy of a string in uppercase

procedure Val(S; var V; var Code: Integer);

System

Converts a string to a numeric representation

function WideLowerCase(const S: WideString): WideString;

SysUtils

Returns Unicode string converted to lower case.

function WideSameStr(const S1, S2: WideString): Boolean;

SysUtils

Compares Unicode strings based on the current locale with case sensitivity.

function WideSameText(const S1, S2: WideString): Boolean;

SysUtils

Compares Unicode strings based on the current locale without case sensitivity.

function WideUpperCase(const S: WideString): WideString;

SysUtils

Returns Unicode string converted to upper case.

function WrapText(const Line, BreakStr: string; nBreakChars: TSysCharSet; MaxCol: Integer):string; overload;

SysUtils

Splits a string into multiple lines as its length approaches a specified size

function WrapText(const Line, MaxCol: Integer): string; overload;

SysUtils

Splits a string into multiple lines as its length approaches a specified size

 

26.    String Handling Routines (null terminated)

 

 

Checked on 24-5-2004

function AnsiStrComp(S1, S2: PChar): Integer;

SysUtils

Compares S1 to S2, with case sensitivity.

function AnsiStrIComp(S1, S2: PChar): Integer;

SysUtils

Compares null terminated character strings case insensitively.

function AnsiStrLComp(S1, S2: PChar; MaxLen: Cardinal): Integer;

SysUtils

Compares the first MaxLen bytes of two null-terminated strings, case-sensitively.

function AnsiStrLIComp(S1, S2: PChar; MaxLen: Cardinal): Integer;

SysUtils

Compares two strings, case-insensitively, up to the first MaxLen bytes.

function AnsiStrLower(Str: PChar): PChar;

SysUtils

Converts all characters in a null-terminated string to lower case.

function AnsiStrPos(Str, SubStr: PChar): PChar;

SysUtils

Returns a pointer to the first occurrence of SubStr in Str.

function AnsiStrRScan(Str: PChar; Chr: Char): PChar;

SysUtils

Returns a pointer to the last occurrence of a specified character in a specified string.

function AnsiStrScan(Str: PChar; Chr: Char): PChar;

SysUtils

Returns a pointer to first occurrence of a character in a string.

function AnsiStrUpper(Str: PChar): PChar;

SysUtils

Converts all characters in a null-terminated string to upper case.

function ExtractStrings(Separators, WhiteSpace: TSysCharSet; Content: PChar; Strings: TStrings): Integer;

Classes

Fills a string list with substrings parsed from a delimited list.

function LineStart(Buffer, BufPos: PChar): PChar;

Classes

Finds the end of the last whole line in a buffer.

function SearchBuf(Buf: PChar; BufLen: Integer; SelStart, SelLength: Integer; SearchString: String; Options: TStringSearchOptions = [soDown]): PChar;

StrUtils

Locates a substring within a text buffer.

function StrCat(Dest: PChar; const Source: PChar): PChar;

SysUtils

Appends a copy of Source to the end of Dest and returns the concatenated string.

function StrComp(const Str1, Str2 : PChar): Integer;

SysUtils

Compares two strings with case sensitivity.

function StrCopy(Dest: PChar; const Source: PChar): PChar;

SysUtils

Copies Source to Dest and returns Dest.

function StrECopy(Dest: PChar; const Source: PChar): PChar;

SysUtils

Copies null-terminated string.

function StrEnd(const Str: PChar): PChar;

SysUtils

Returns a pointer to the end of a null terminated string.

function StrIComp(const Str1, Str2:PChar): Integer;

SysUtils

Compares two strings without case sensitivity.

function StrLCat(Dest: PChar; const Source: PChar; MaxLen: Cardinal): PChar;

SysUtils

Appends up to a specified maximum number of characters to string.

function StrLComp(const Str1, Str2: PChar; MaxLen: Cardinal): Integer;

SysUtils

Compares up to a specified maximum number of characters in two strings.

function StrLCopy(Dest: PChar; const Source: PChar; MaxLen: Cardinal): PChar;

SysUtils

Copies up to a specified maximum number of characters from Source to Dest.

function StrLen(const Str: PChar): Cardinal;

SysUtils

Returns number of characters in a string excluding the null terminator.

function StrLIComp(const Str1, Str2: PChar; MaxLen: Cardinal): Integer;

SysUtils

Compares strings up to a specified maximum number of characters, without case sensitivity.

function StrLower(Str: PChar): PChar;

SysUtils

Converts a string to lowercase.

function StrMove(Dest: PChar; const Source: PChar; Count: Cardinal): PChar;

SysUtils

Copies specified number of characters to string.

function StrPCopy(Dest: PChar; const Source: string): PChar;

SysUtils

Copies a Pascal string to a null-terminated string.

function StrPLCopy(Dest: PChar; const Source: string; MaxLen: Cardinal): PChar;

SysUtils

Copies characters from a Pascal-style string into a null-terminated string.

function StrPos(const Str1, Str2: PChar): PChar;

SysUtils

Returns a pointer to the first occurrence of STR2 in STR1.

function StrRScan(const Str: PChar; Chr: Char): PChar;

SysUtils

Returns a pointer to the last occurrence of a specified character in a string.

function StrScan(const Str: PChar; Chr: Char): PChar;

SysUtils

Returns a pointer to first occurrence of a specified character in a string.

function StrUpper(Str: PChar): PChar;

SysUtils

Returns a string in upper case.

 

27.    Termination Procedure Support

 

 

Checked on 27-5-2004

procedure AddTerminateProc(TermProc: TTerminateProc);

SysUtils

Adds a terminate procedure to the system list of termination procedures

function CallTerminateProcs: Boolean;

Sysutils

Calls all of the functions in the termination procedure list

var ExitProc: Pointer;

SysUtils

Points to a program's exit procedure

 

28.    Text File Routines

 

 

Updated on 27-5-2004

procedure AssignPrn(var F: Text);

Printers

Assigns a text-file variable to the printer

function Eoln [(var F: Text) ]: Boolean;

System

Tests whether the file pointer is at the end of a line

procedure Erase(var F);

System

Deletes an external file

procedure Flush(var F: Text);

System

Empties the buffer of a text file opened for output

procedure Read(F , V1 [, V2,...,Vn ] );
procedure Read( [ var F: Text; ] V1 [, V2,...,Vn ] );

System

Read reads data from a file

procedure Readln([ var F: Text; ] V1 [, V2, ...,Vn ]);

System

Reads a line of text from a file

function SeekEof [ (var F: Text) ]: Boolean;

System

Returns the end-of-file status of a file

function SeekEoln [ (var F: Text) ]: Boolean;

System

Returns the end-of-line status of a file

procedure SetLineBreakStyle(var T: Text; Style: TTextLineBreakStyle);

System

Determines the end-of-line and end-of-file conventions for text file I/O.

procedure SetTextBuf(var F: Text; var Buf [ ; Size: Integer] );

System

Assigns an I/O buffer to a text file

procedure Write( [var F: Text; ] P1 [ , P2,..., Pn] );

System

Writes to a text file

procedure Writeln([ var F: Text; ] P1 [, P2, ...,Pn ] );

System

Writes an end-of-line marker to a text file

 

29.    Trigonometry Routines

 

 

Updated on 27-5-2004

function ArcCos(X: Extended): Extended;

Math

Calculates the inverse cosine of a given number

function ArcCosh(X: Extended): Extended;

Math

Calculates the inverse hyperbolic cosine of a given number

function ArcCot(const X: Extended): Extended;

Math

Calculates the inverse cotangent of a given number.

function ArcCotH(const X: Extended): Extended;

Math

Calculates the inverse hyperbolic cotangent of a given number.

function ArcCsc(const X: Extended): Extended;

Math

Calculates the inverse cosecant of a given number.

function ArcCscH(const X: Extended): Extended;

Math

Calculates the inverse hyperbolic cosecant of a given number.

function ArcSec(const X: Extended): Extended;

Math

Calculates the inverse secant of a given number.

function ArcSecH(const X: Extended): Extended;

Math

Calculates the inverse hyperbolic secant of a given number.

function ArcSin(X: Extended): Extended;

Math

Calculates the inverse sine of a given number

function ArcSinh(X: Extended): Extended;

Math

Calculates the inverse hyperbolic sine of a given number

function ArcTan(X: Extended): Extended;

System

Calculates the arctangent of a given number

function ArcTan2(Y, X: Extended): Extended;

Math

Calculates the arctangent angle and quadrant of a given number

function ArcTanh(X: Extended): Extended;

Math

Calculates the inverse hyperbolic tangent of a given number

function Cos(X: Extended): Extended;

System

Calculates the cosine of an angle

function Cosecant(const X: Extended): Extended;

Math

Returns the cosecant of an angle.

function Cosh(X: Extended): Extended;

Math

Calculates the hyperbolic cosine of an angle

function Cot(const X: Extended): Extended;

Math

Calculates the cotangent of an angle.

function Cotan(X: Extended): Extended;

Math

Calculates the cotangent of an angle

function CotH(const X: Extended): Extended;

Math

Calculates the hyperbolic cotangent of an angle.

function Csc(const X: Extended): Extended;

Math

Returns the cosecant of an angle.

function CscH(const X: Extended): Extended;

Math

Returns the hyperbolic cosecant of an angle.

function Hypot(X, Y: Extended): Extended;

Math

Calculates the length of the hypotenuse

function Sec(const X: Extended): Extended;

Math

Calculates the secant of an angle.

function Secant(const X: Extended): Extended;

Math

Calculates the secant of an angle.

function SecH(const X: Extended): Extended;

Math

Calculates the hyperbolic secant of an angle.

function Sin(X: Extended): Extended;

System

Returns the sine of the angle in radians

procedure SinCos(Theta: Extended; var Sin, Cos: Extended);

Math

Returns sine and cosine of an angle

function Sinh(X: Extended): Extended;

Math

Returns the hyperbolic sine of an angle

function Tan(X: Extended): Extended;

Math

Returns the tangent of X

function Tanh(X: Extended): Extended;

Math

Returns the hyperbolic tangent of X

 

30.    Type Conversion Routines

 

 

Updated on 27-5-2004

function BCDToCurr(const BCD: TBcd; var Curr: Currency): Boolean;

Db

Converts a binary coded decimal value (BCD) to the corresponding Currency value

procedure BinToHex(Buffer, Text: PChar; BufSize: Integer);

Classes

Converts a binary value into its hexadecimal representation.

function BoolToStr(B: Boolean; UseBoolStrs: Boolean = False): string;

SysUtils

Converts a boolean value to a string.

function Bounds(ALeft, ATop, AWidth, AHeight: Integer): TRect;

Classes

Returns the TRect for a rectangle of given dimensions

function CompToCurrency(acomp: Comp): Currency;

System

Converts a Comp value to a Currency value

function CompToDouble(acomp: Comp): Double;

System

Converts a Comp value to a Double value

function CurrToBCD(Curr: Currency; var BCD: FMTBcd; Precision: Integer=32; Decimals: Integer=4): Boolean;

DbCommon

Converts a Currency value to the corresponding binary coded decimal (BCD) value

procedure CurrencyToComp(acurrency: Currency; var result: Comp);

System

Converts a Currency value to a Comp value

var FalseBoolStrs: array of String;

SysUtils

Lists strings that can represent the boolean value False.

function HexToBin(Text, Buffer: PChar; BufSize: Integer): Integer

Classes

Converts a string of hexadecimal digits to the corresponding binary value.

function OffsetRect(var Rect: TRect; DX: Integer; DY: Integer): Boolean;

Types

Changes the origin of a rectangle by a specified amount.

function Point(AX, AY: Integer): TPoint;

Classes

Creates a TPoint structure from a pair of coordinates

function Rect(ALeft, ATop, ARight, ABottom: Integer): TRect; overload;

function Rect(const ATopLeft, ABottomRight: TPoint): TRect; overload;

Classes

Creates a TRect structure from a set of coordinates

function SmallPoint(AX, AY: SmallInt): TSmallPoint;

Classes

Creates a TSmallPoint structure from a pair of coordinates.

function StrToBool(const S: string): Boolean;

SysUtils

Converts a string to a boolean value.

function StrToInt(const S: string): Integer;

SysUtils

Converts a string that represents an integer (decimal or hex notation) to a number

function StrToInt64(const S: string): Int64;

SysUtils

Converts a string that represents an integer (decimal or hex notation) to a number

function StrToInt64Def(const S: string; Default: Int64): Int64;

SysUtils

Converts a string that represents an integer (decimal or hex notation) to a number

function StrToIntDef(const S: string; Default: Integer): Integer;

SysUtils

Converts a string that represents an integer (decimal or hex notation) to a number

var TrueBoolStrs: array of String;

SysUtils

Lists strings that can represent the boolean value True.

 



[1] The parameters and the result can be: Integer, Int64, Single, Double and Extended