%
%   $Id$
%   This file is part of the FPC documentation.
%   Copyright (C) 1999, by Michael Van Canneyt
%
%   The FPC documentation is free text; you can redistribute it and/or
%   modify it under the terms of the GNU Library General Public License as
%   published by the Free Software Foundation; either version 2 of the
%   License, or (at your option) any later version.
%
%   The FPC Documentation is distributed in the hope that it will be useful,
%   but WITHOUT ANY WARRANTY; without even the implied warranty of
%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
%   Library General Public License for more details.
%
%   You should have received a copy of the GNU Library General Public
%   License along with the FPC documentation; see the file COPYING.LIB.  If not,
%   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
%   Boston, MA 02111-1307, USA. 
%
\chapter{The SYSUTILS unit.}

This chapter describes the \file{sysutils} unit. The \var{sysutils} unit 
was largely written by Gertjan Schouten, and completed by michael Van Canneyt. 
It aims to be compatible to the Delphi sysutils unit, but in contrast with 
the latter, it is designed to work on multiple platforms.

This chapter starts out with a definition of all types and constants 
that are defined, followed by a complete explanation of each function.

\section{Constants and types}

The following general-purpose constants are defined:
\begin{verbatim}
const
   SecsPerDay = 24 * 60 * 60; // Seconds and milliseconds per day
   MSecsPerDay = SecsPerDay * 1000;
   DateDelta = 693594;        // Days between 1/1/0001 and 12/31/1899
   Eoln = #10;
\end{verbatim}
The following types are used frequently in date and time functions.
They are the same on all platforms.
\begin{verbatim}
type
   TSystemTime = record
      Year, Month, Day: word;
      Hour, Minute, Second, MilliSecond: word;
   end ;

   TDateTime = double;

   TTimeStamp = record
      Time: integer;   { Number of milliseconds since midnight }
      Date: integer;   { One plus number of days since 1/1/0001 }
   end ;
\end{verbatim}
The following type is used in the \seef{FindFirst},\seef{FindNext} 
and \seep{FindClose} functions. The \var{win32} version differs from 
the other versions. If code is to be portable, that part  shouldn't 
be used.
\begin{verbatim}
Type 
  THandle = Longint; 
  TSearchRec = Record
    Time,Size, Attr : Longint;
    Name : TFileName;
    ExcludeAttr : Longint;
    FindHandle : THandle;
    {$ifdef Win32}
    FindData : TWin32FindData;        
    {$endif}
    end;
\end{verbatim}
The following constants are file-attributes that need to be matched in the 
findfirst call.
\begin{verbatim}
Const 
  faReadOnly  = $00000001; 
  faHidden    = $00000002;
  faSysFile   = $00000004;
  faVolumeId  = $00000008;
  faDirectory = $00000010;
  faArchive   = $00000020;
  faAnyFile   = $0000003f;
\end{verbatim}
The following constants can be used in the \seef{FileOpen} call.
\begin{verbatim}
Const
  fmOpenRead       = $0000;
  fmOpenWrite      = $0001;
  fmOpenReadWrite  = $0002;
\end{verbatim}
The following variables are used in the case translation routines.
\begin{verbatim}
type
   TCaseTranslationTable = array[0..255] of char;
var
   UpperCaseTable: TCaseTranslationTable;
   LowerCaseTable: TCaseTranslationTable;
\end{verbatim}
The initialization code of the \file{sysutils} unit fills these 
tables with the appropriate values. For the win32 and go32v2
versions, this information is obtained from the operating system.

The following constants control the formatting of dates.
For the Win32 version of the \file{sysutils} unit, these 
constants are set according to the internationalization 
settings of Windows by the initialization code of the unit.
\begin{verbatim}
Const 
   DateSeparator: char = '-';
   ShortDateFormat: string = 'd/m/y';
   LongDateFormat: string = 'dd" "mmmm" "yyyy';
   ShortMonthNames: array[1..12] of string[128] =
     ('Jan','Feb','Mar','Apr','May','Jun',
      'Jul','Aug','Sep','Oct','Nov','Dec');
   LongMonthNames: array[1..12] of string[128] =
     ('January','February','March','April',
      'May','June','July','August',
      'September','October','November','December');
   ShortDayNames: array[1..7] of string[128] =
     ('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
   LongDayNames: array[1..7] of string[128] =
     ('Sunday','Monday','Tuesday','Wednesday',
       'Thursday','Friday','Saturday');
\end{verbatim}  

The following constants control the formatting of times.
For the Win32 version of the \file{sysutils} unit, these 
constants are set according to the internationalization 
settings of Windows by the initialization code of the unit.
\begin{verbatim}
Const
   ShortTimeFormat: string = 'hh:nn';
   LongTimeFormat: string = 'hh:nn:ss';
   TimeSeparator: char = ':';
   TimeAMString: string[7] = 'AM';
   TimePMString: string[7] = 'PM';
\end{verbatim}

The following constants control the formatting of currencies 
and numbers. For the Win32 version of the \file{sysutils} unit, 
these  constants are set according to the internationalization 
settings of Windows by the initialization code of the unit.
\begin{verbatim}
Const
  DecimalSeparator : Char = '.';
  ThousandSeparator : Char = ',';
  CurrencyDecimals : Byte = 2;
  CurrencyString : String[7] = '$';
  { Format to use when formatting currency :
    0 = $1        1 = 1$         2 = $ 1      3 = 1 $
    4 = Currency string replaces decimal indicator. 
        e.g. 1$50 
   }
  CurrencyFormat : Byte = 1;
  { Same as above, only for negative currencies:
    0 = ($1)
    1 = -$1
    2 = $-1
    3 = $1-
    4 = (1$)
    5 = -1$
    6 = 1-$
    7 = 1$-
    8 = -1 $
    9 = -$ 1
    10 = $ 1-
   }
  NegCurrFormat : Byte = 5;
\end{verbatim}
The following types are used in various string functions.
\begin{verbatim}
type
   PString = ^String;
   TFloatFormat = (ffGeneral, ffExponent, ffFixed, ffNumber, ffCurrency);
\end{verbatim}
The following constants are used in the file name handling routines. Do not
use a slash of backslash character directly as a path separator; instead 
use the \var{OsDirSeparator} character.
\begin{verbatim}
Const
  DirSeparators : set of char = ['/','\'];  
{$ifdef Linux}
  OSDirSeparator = '/';
{$else}
  OsDirSeparator = '\';
{$endif}
\end{verbatim}

\section{Date and time functions}

\subsection{Date and time formatting characters}
\label{se:formatchars}

Various date and time formatting routines accept a format string.
to format the date and or time. The following characters can be used
to control the date and time formatting:
\begin{description}
\item[c] : shortdateformat + ' ' + shorttimeformat
\item[d] : day of month
\item[dd] : day of month (leading zero)
\item[ddd] : day of week (abbreviation)
\item[dddd] : day of week (full)
\item[ddddd] : shortdateformat
\item[dddddd] : longdateformat
\item[m] : month
\item[mm] : month (leading zero)
\item[mmm] : month (abbreviation)
\item[mmmm] : month (full)
\item[y] : year (four digits)
\item[yy] : year (two digits)
\item[yyyy] : year (with century)
\item[h] : hour
\item[hh] : hour (leading zero)
\item[n] : minute
\item[nn] : minute (leading zero)
\item[s] : second
\item[ss] : second (leading zero)
\item[t] : shorttimeformat
\item[tt] : longtimeformat
\item[am/pm] : use 12 hour clock and display am and pm accordingly
\item[a/p] : use 12 hour clock and display a and p accordingly
\item[/] : insert date seperator
\item[:] : insert time seperator
\item["xx"] : literal text
\item['xx'] : literal text
\end{description}

\begin{type}{TDateTime}
\Declaration
  TDateTime = Double;
\Description
Many functions return or require a \var{TDateTime} type, which contains
a date and time in encoded form. The date and time are converted to a double
as follows:
\end{type}

\begin{function}{Date}
\Declaration
Function Date: TDateTime;
\Description
\var{Date} returns the current date in \var{TDateTime} format. 
For more information about the \var{TDateTime} type, see \seety{TDateTime}.
\Errors
None.
\SeeAlso
\seef{Time},\seef{Now}, \seety{TDateTime}.
\end{function}

\latex{\inputlisting{sysutex/ex1.pp}}
\html{\input{sysutex/ex1.tex}}

\begin{function}{DateTimeToFileDate}
\Declaration
Function DateTimeToFileDate(DateTime : TDateTime) : Longint;
\Description
\var{DateTimeToFileDate} function converts a date/time indication in
\var{TDateTime} format to a filedate function, such as returned for 
instance by the \seef{FileAge} function.
\Errors
None.
\SeeAlso
\seef{Time}, \seef{Date}, \seef{FileDateToDateTime},
\seep{DateTimeToSystemTime}, \seef{DateTimeToTimeStamp}
\end{function}

\latex{\inputlisting{sysutex/ex2.pp}}
\html{\input{sysutex/ex2.tex}}
 
\begin{function}{DateTimeToStr}
\Declaration
Function DateTimeToStr(DateTime: TDateTime): string;
\Description
\var{DateTimeToStr} returns a string representation of 
\var{DateTime} using the formatting specified in
\var{ShortDateTimeFormat}. It corresponds to a call to 
\var{FormatDateTime('c',DateTime)} (see \sees{formatchars}).
\Errors
None.
\SeeAlso
\seef{FormatDateTime}, \seety{TDateTime}.
\end{function}

\latex{\inputlisting{sysutex/ex3.pp}}
\html{\input{sysutex/ex3.tex}}
 
\begin{procedure}{DateTimeToString}
\Declaration
Procedure DateTimeToString(var Result: string; const FormatStr: string; const DateTime: TDateTime);
\Description
\var{DateTimeToString} returns in \var{Result} a string representation of 
\var{DateTime} using the formatting specified in \var{FormatStr}. 

for a list of characters that can be used in the \var{FormatStr} formatting
string, see \sees{formatchars}.
\Errors
In case a wrong formatting character is found, an \var{EConvertError} is
raised.
\SeeAlso
\seef{FormatDateTime}, \sees{formatchars}.
\end{procedure}

\latex{\inputlisting{sysutex/ex4.pp}}
\html{\input{sysutex/ex4.tex}}
 
\begin{procedure}{DateTimeToSystemTime}
\Declaration
Procedure DateTimeToSystemTime(DateTime: TDateTime; var SystemTime: TSystemTime);
\Description
\var{DateTimeToSystemTime} converts a date/time pair in \var{DateTime}, with
\var{TDateTime} format to a system time \var{SystemTime}.
\Errors
None.
\SeeAlso
\seef{DateTimeToFileDate}, \seef{SystemTimeToDateTime},
\seef{DateTimeToTimeStamp}
\end{procedure}

\latex{\inputlisting{sysutex/ex5.pp}}
\html{\input{sysutex/ex5.tex}}

\begin{function}{DateTimeToTimeStamp}
\Declaration
Function DateTimeToTimeStamp(DateTime: TDateTime): TTimeStamp;
\Description
\var{DateTimeToSystemTime} converts a date/time pair in \var{DateTime}, with
\var{TDateTime} format to a \var{TTimeStamp} format.
\Errors
None.
\SeeAlso
\seef{DateTimeToFileDate}, \seef{SystemTimeToDateTime},
\seef{DateTimeToSystemTime}
\end{function}

\latex{\inputlisting{sysutex/ex6.pp}}
\html{\input{sysutex/ex6.tex}}

\begin{function}{DateToStr}
\Declaration
Function DateToStr(Date: TDateTime): string;
\Description
\var{DateToStr} converts \var{Date} to a string representation. It uses
\var{ShortDateFormat} as it's formatting string. It is hence completely
equivalent to a \var{FormatDateTime('ddddd', Date)}.
\Errors
None.
\SeeAlso
\seef{TimeToStr}, \seef{DateTimeToStr}, \seef{FormatDateTime},
\seef{StrToDate}
\end{function}


\latex{\inputlisting{sysutex/ex7.pp}}
\html{\input{sysutex/ex7.tex}}
 
\begin{function}{DayOfWeek}
\Declaration
Function DayOfWeek(DateTime: TDateTime): integer;
\Description
\var{DayOfWeek} returns the day of the week from \var{DateTime}.
\var{Sunday} is counted as day 1, \var{Saturday} is counted as 
day 7. The result of \var{DayOfWeek} can serve as an index to 
the \var{LongDayNames} constant array, to retrieve the name of 
the day.
\Errors
None.
\SeeAlso
\seef{Date}, \seef{DateToStr}
\end{function}


\latex{\inputlisting{sysutex/ex8.pp}}
\html{\input{sysutex/ex8.tex}}

\begin{procedure}{DecodeDate}
\Declaration
Procedure DecodeDate(Date: TDateTime; var Year, Month, Day: word);
\Description
\var{DecodeDate} decodes the Year, Month and Day stored in \var{Date},
and returns them in the \var{Year}, \var{Month} and \var{Day} variables.
\Errors
None.
\SeeAlso
\seef{EncodeDate}, \seep{DecodeTime}.
\end{procedure}

\latex{\inputlisting{sysutex/ex9.pp}}
\html{\input{sysutex/ex9.tex}}

 
\begin{procedure}{DecodeTime}
\Declaration
Procedure DecodeTime(Time: TDateTime; var Hour, Minute, Second, MilliSecond: word);
\Description
\var{DecodeDate} decodes the hours, minutes, second and milliseconds stored 
in \var{Time}, and returns them in the \var{Hour}, \var{Minute} and
\var{Second} and \var{MilliSecond} variables.
\Errors
None.
\SeeAlso
\seef{EncodeTime}, \seep{DecodeDate}.
\end{procedure}

\latex{\inputlisting{sysutex/ex10.pp}}
\html{\input{sysutex/ex10.tex}}
 
\begin{function}{EncodeDate}
\Declaration
Function EncodeDate(Year, Month, Day :word): TDateTime;
\Description
\var{EncodeDate} encodes the \var{Year}, \var{Month} and \var{Day} variables to 
a date in \var{TDateTime} format. It does the opposite of the
\seep{DecodeDate} procedure.

The parameters must lie withing valid ranges (boundaries included):
\begin{description}
\item[Year] must be between 1 and 9999.
\item[Month] must be within the range 1-12.
\item[Day] msut be between 1 and 31.
\end{description}
\Errors
In case one of the parameters is out of it's valid range, 0 is returned.
\SeeAlso
\seef{EncodeTime}, \seep{DecodeDate}.
\end{function}

\latex{\inputlisting{sysutex/ex11.pp}}
\html{\input{sysutex/ex11.tex}}

\begin{function}{EncodeTime}
\Declaration
Function EncodeTime(Hour, Minute, Second, MilliSecond:word): TDateTime;
\Description
\var{EncodeTime} encodes the \var{Hour}, \var{Minute}, \var{Second},
\var{MilliSecond} variables to a \var{TDateTime} format result.
It does the opposite of the \seep{DecodeTime} procedure.

The parameters must have a valid range (boundaries included):
\begin{description}
\item[Hour] must be between 0 and 23.
\item[Minute,second] must both be between 0 and 59.
\item[Millisecond] must be between 0 and 999.
\end{description}
\Errors
In case one of the parameters is outside of it's valid range, 0 is returned.
\SeeAlso
\seef{EncodeDate}, \seep{DecodeTime}.
\end{function}

\latex{\inputlisting{sysutex/ex12.pp}}
\html{\input{sysutex/ex12.tex}}

 
\begin{function}{FileDateToDateTime}
\Declaration
Function FileDateToDateTime(Filedate : Longint) : TDateTime;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{FormatDateTime}
\Declaration
Function FormatDateTime(FormatStr: string; DateTime: TDateTime):string;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{IncMonth}
\Declaration
Function IncMonth(const DateTime: TDateTime; NumberOfMonths: integer): TDateTime;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{IsLeapYear}
\Declaration
Function IsLeapYear(Year: Word): boolean;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{MSecsToTimeStamp}
\Declaration
Function MSecsToTimeStamp(MSecs: Comp): TTimeStamp;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{Now}
\Declaration
Function Now: TDateTime;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrToDate}
\Declaration
Function StrToDate(const S: string): TDateTime;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrToDateTime}
\Declaration
Function StrToDateTime(const S: string): TDateTime;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrToTime}
\Declaration
Function StrToTime(const S: string): TDateTime;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{SystemTimeToDateTime}
\Declaration
Function SystemTimeToDateTime(const SystemTime: TSystemTime): TDateTime;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{Time}
\Declaration
Function Time: TDateTime;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{TimeStampToDateTime}
\Declaration
Function TimeStampToDateTime(const TimeStamp: TTimeStamp): TDateTime;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{TimeStampToMSecs}
\Declaration
Function TimeStampToMSecs(const TimeStamp: TTimeStamp): comp;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{TimeToStr}
\Declaration
Function TimeToStr(Time: TDateTime): string;
\Description
\Errors
\SeeAlso
\end{function}

 

\section{Disk functions}

\begin{function}{CreateDir}
\Declaration
Function CreateDir(Const NewDir : String) : Boolean;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{DiskFree}
\Declaration
Function DiskFree(Drive : Byte) : Longint;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{DiskSize}
\Declaration
Function DiskSize(Drive : Byte) : Longint;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{GetCurrentDir}
\Declaration
Function GetCurrentDir : String;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{RemoveDir}
\Declaration
Function RemoveDir(Const Dir : String) : Boolean;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{SetCurrentDir}
\Declaration
Function SetCurrentDir(Const NewDir : String) : Boolean;
\Description
\Errors
\SeeAlso
\end{function}

 


\section{File handling functions}

      
  
\begin{function}{ChangeFileExt}
\Declaration
Function ChangeFileExt(const FileName, Extension: string): string;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{DeleteFile}
\Declaration
Function DeleteFile(Const FileName : String) : Boolean;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{procedure}{DoDirSeparators}
\Declaration
Procedure DoDirSeparators(Var FileName : String);
\Description
\Errors
\SeeAlso
\end{procedure}

 
\begin{function}{ExpandFileName}
\Declaration
Function ExpandFileName(Const FileName : string): String;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{ExpandUNCFileName}
\Declaration
Function ExpandUNCFileName(Const FileName : string): String;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{ExtractFileDir}
\Declaration
Function ExtractFileDir(Const FileName : string): string;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{ExtractFileDrive}
\Declaration
Function ExtractFileDrive(const FileName: string): string;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{ExtractFileExt}
\Declaration
Function ExtractFileExt(const FileName: string): string; 
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{ExtractFileName}
\Declaration
Function ExtractFileName(const FileName: string): string;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{ExtractFilePath}
\Declaration
Function ExtractFilePath(const FileName: string): string;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{ExtractRelativepath}
\Declaration
Function ExtractRelativepath(Const BaseName,DestNAme : String): String;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{FileAge}
\Declaration
Function FileAge(Const FileName : String): Longint;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{procedure}{FileClose}
\Declaration
Procedure FileClose(Handle : Longint);
\Description
\Errors
\SeeAlso
\end{procedure}

 
\begin{function}{FileCreate}
\Declaration
Function FileCreate(Const FileName : String) : Longint;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{FileExists}
\Declaration
Function FileExists(Const FileName : String) : Boolean;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{FileGetAttr}
\Declaration
Function FileGetAttr(Const FileName : String) : Longint;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{FileGetDate}
\Declaration
Function FileGetDate(Handle : Longint) : Longint;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{FileOpen}
\Declaration
Function FileOpen(Const FileName : string; Mode : Integer) : Longint;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{FileRead}
\Declaration
Function FileRead(Handle : Longint; Var Buffer; Count : longint) : Longint;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{FileSearch}
\Declaration
Function FileSearch(Const Name, DirList : String) : String;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{FileSeek}
\Declaration
Function FileSeek(Handle,Offset,Origin : Longint) : Longint;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{FileSetAttr}
\Declaration
Function FileSetAttr(Const Filename : String; Attr: longint) : Longint;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{FileSetDate}
\Declaration
Function FileSetDate(Handle,Age : Longint) : Longint;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{FileTruncate}
\Declaration
Function FileTruncate(Handle,Size: Longint) : boolean;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{FileWrite}
\Declaration
Function FileWrite(Handle : Longint; Var Buffer; Count : Longint) : Longint;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{procedure}{FindClose}
\Declaration
Procedure FindClose(Var F : TSearchrec);
\Description
\Errors
\SeeAlso
\end{procedure}

 
\begin{function}{FindFirst}
\Declaration
Function FindFirst(Const Path : String; Attr : Longint; Var Rslt : TSearchRec) : Longint;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{FindNext}
\Declaration
Function FindNext(Var Rslt : TSearchRec) : Longint;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{GetDirs}
\Declaration
Function GetDirs(Var DirName : String; Var Dirs : Array of pchar) : Longint; 
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{RenameFile}
\Declaration
Function RenameFile(Const OldName, NewName : String) : Boolean;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{SetDirSeparators}
\Declaration
Function SetDirSeparators(Const FileName : String) : String;
\Description
\Errors
\SeeAlso
\end{function}

 

\section{PChar functions}

\begin{function}{StrAlloc}
\Declaration
Function StrAlloc(Size: cardinal): PChar;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrBufSize}
\Declaration
Function StrBufSize(var Str: PChar): cardinal;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{procedure}{StrDispose}
\Declaration
Procedure StrDispose(var Str: PChar);
\Description
\Errors
\SeeAlso
\end{procedure}

 
\begin{function}{StrPCopy}
\Declaration
Function StrPCopy(Dest: PChar; Source: string): PChar;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrPLCopy}
\Declaration
Function StrPLCopy(Dest: PChar; Source: string; MaxLen: cardinal): PChar;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrPas}
\Declaration
Function StrPas(Str: PChar): string;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrCat}
\Declaration
Function StrCat(dest,source : pchar) : pchar;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrComp}
\Declaration
Function StrComp(str1,str2 : pchar) : longint;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrCopy}
\Declaration
Function StrCopy(dest,source : pchar) : pchar;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrECopy}
\Declaration
Function StrECopy(dest,source : pchar) : pchar;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrEnd}
\Declaration
Function StrEnd(p : pchar) : pchar;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrIComp}
\Declaration
Function StrIComp(str1,str2 : pchar) : longint;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrLCat}
\Declaration
Function StrLCat(dest,source : pchar;l : longint) : pchar;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrLComp}
\Declaration
Function StrLComp(str1,str2 : pchar;l : longint) : longint;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrLCopy}
\Declaration
Function StrLCopy(dest,source : pchar;maxlen : longint) : pchar;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrLen}
\Declaration
Function StrLen(p : pchar) : longint;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrLIComp}
\Declaration
Function StrLIComp(str1,str2 : pchar;l : longint) : longint;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrLower}
\Declaration
Function strlower(p : pchar) : pchar;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrMove}
\Declaration
Function StrMove(dest,source : pchar;l : longint) : pchar;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrNew}
\Declaration
Function StrNew(p : pchar) : pchar;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrPos}
\Declaration
Function StrPos(str1,str2 : pchar) : pchar;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrRScan}
\Declaration
Function StrRScan(p : pchar;c : char) : pchar;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrScan}
\Declaration
Function StrScan(p : pchar;c : char) : pchar;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrUpper}
\Declaration
Function StrUpper(p : pchar) : pchar;
\Description
\Errors
\SeeAlso
\end{function}

\section{String functions}

\begin{function}{AdjustLineBreaks}
\Declaration
Function AdjustLineBreaks(const S: string): string;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{AnsiCompareStr}
\Declaration
Function AnsiCompareStr(const S1, S2: string): integer;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{AnsiCompareText}
\Declaration
Function AnsiCompareText(const S1, S2: string): integer;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{AnsiExtractQuotedStr}
\Declaration
Function AnsiExtractQuotedStr(var Src: PChar; Quote: Char): string;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{AnsiLastChar}
\Declaration
Function AnsiLastChar(const S: string): PChar;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{AnsiLowerCase}
\Declaration
Function AnsiLowerCase(const s: string): string;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{AnsiQuotedStr}
\Declaration
Function AnsiQuotedStr(const S: string; Quote: char): string;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{AnsiStrComp}
\Declaration
Function AnsiStrComp(S1, S2: PChar): integer;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{AnsiStrIComp}
\Declaration
Function AnsiStrIComp(S1, S2: PChar): integer;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{AnsiStrLComp}
\Declaration
Function AnsiStrLComp(S1, S2: PChar; MaxLen: cardinal): integer;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{AnsiStrLIComp}
\Declaration
Function AnsiStrLIComp(S1, S2: PChar; MaxLen: cardinal): integer;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{AnsiStrLast}
\Declaration
Function AnsiStrLast(Str: PChar): PChar;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{CharAnsiStrLower}
\Declaration
Function AnsiStrLower(Str: PChar): PChar;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{AnsiStrUpper}
\Declaration
Function AnsiStrUpper(Str: PChar): PChar;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{AnsiUpperCase}
\Declaration
Function AnsiUpperCase(const s: string): string;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{procedure}{AppendStr}
\Declaration
Procedure AppendStr(var Dest: PString; const S: string);
\Description
\Errors
\SeeAlso
\end{procedure}

 
\begin{procedure}{AssignStr}
\Declaration
Procedure AssignStr(var P: PString; const S: string);
\Description
\Errors
\SeeAlso
\end{procedure}

 
\begin{function}{BCDToInt}
\Declaration
Function BCDToInt(Value: integer): integer;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{CompareMem}
\Declaration
Function CompareMem(P1, P2: Pointer; Length: cardinal): integer;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{CompareStr}
\Declaration
Function CompareStr(const S1, S2: string): Integer;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{CompareText}
\Declaration
Function CompareText(const S1, S2: string): integer;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{procedure}{DisposeStr}
\Declaration
Procedure DisposeStr(S: PString);
\Description
\Errors
\SeeAlso
\end{procedure}

 
\begin{function}{FloatToStr}
\Declaration
Function FloatToStr(Value: Extended): String;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{FloatToStrF}
\Declaration
Function FloatToStrF(Value: Extended; format: TFloatFormat; Precision, Digits: Integer): String;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{procedure}{FmtStr}
\Declaration
Procedure (Var Res: String; Const Fmt : String; Const args: Array of const);
\Description
\Errors
\SeeAlso
\end{procedure}

 
\begin{function}{Format}
\Declaration
Function Format(Const Fmt : String; const Args : Array of const) : String;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{FormatBuf}
\Declaration
Function FormatBuf(Var Buffer; BufLen : Cardinal; Const Fmt; fmtLen : Cardinal; Const Args : Array of const) : Cardinal;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{IntToHex}
\Declaration
Function IntToHex(Value: integer; Digits: integer): string;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{IntToStr}
\Declaration
Function IntToStr(Value: integer): string;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{IsValidIdent}
\Declaration
Function IsValidIdent(const Ident: string): boolean;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{LeftStr}
\Declaration
Function LeftStr(const S: string; Count: integer): string;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{LoadStr}
\Declaration
Function LoadStr(Ident: integer): string;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{LowerCase}
\Declaration
Function LowerCase(const s: string): string;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{NewStr}
\Declaration
Function NewStr(const S: string): PString;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{QuotedStr}
\Declaration
Function QuotedStr(const S: string): string;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{RightStr}
\Declaration
Function RightStr(const S: string; Count: integer): string;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrFmt}
\Declaration
Function StrFmt(Buffer,Fmt : PChar; Const args: Array of const) : Pchar;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrLFmt}
\Declaration
Function StrLFmt(Buffer : PCHar; Maxlen : Cardinal;Fmt : PChar; Const args: Array of const) : Pchar;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrToInt}
\Declaration
Function StrToInt(const s: string): integer;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{StrToIntDef}
\Declaration
Function StrToIntDef(const S: string; Default: integer): integer;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{Trim}
\Declaration
Function Trim(const S: string): string;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{TrimLeft}
\Declaration
Function TrimLeft(const S: string): string;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{TrimRight}
\Declaration
Function TrimRight(const S: string): string;
\Description
\Errors
\SeeAlso
\end{function}

 
\begin{function}{UpperCase}
\Declaration
Function UpperCase(const s: string): string;
\Description
\Errors
\SeeAlso
\end{function}

 
