Difference between revisions of "ReNamer:Pascal Script:Functions"

From den4b Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
{| align="right"
 
{| align="right"
 +
|-
 
| __TOC__
 
| __TOC__
 
|}
 
|}
  
== Basic String Handling Routines ==
+
== Basic String Handling Routines ==
  
procedure '''Insert'''(Source: String; var S: String; Index: Integer);
+
{| cellspacing="1" cellpadding="1" border="1" style="width: 752px; height: 167px;"
 +
|-
 +
| procedure '''Insert'''(Source: String; var S: String; Index: Integer);  
 +
| Inserts the string '''S''' into string '''Source''' at position '''Index'''.<br>
 +
|-
 +
| procedure '''Delete'''(var S: String; Index, Count: Integer);
 +
| Deletes '''Count''' characters from the string '''S''', starting from position '''Index'''.<br>
 +
|-
 +
| function '''Copy'''(S: String; Index, Count: Integer): String;
 +
| Copies '''Count''' characters from string '''S''',.starting at position '''Index'''. and returns them as a string.<br>
 +
|-
 +
| function '''Pos'''(Substr: String; S: String): Integer;
 +
| Returns the position of a string '''Substr''' in another string '''S''',<br>
 +
|}
 +
 
 +
<br>
 +
 
 +
== Length Managing Routines  ==
 +
 
 +
{| class="prettytable"
 +
|-
 +
|
 +
| <center>'''Remarks'''</center>
 +
|-
 +
| procedure '''SetLength'''(var S: Array; NewLength: Integer);
 +
| Sets the length of array variable '''S''' as '''NewLength'''.
 +
|-
 +
| procedure '''SetLength'''(var S: String; NewLength: Integer);
 +
| Sets the length of string variable '''S''' as '''NewLength'''.
 +
|-
 +
| procedure '''SetLength'''(var S: WideString; NewLength: Integer);
 +
| Sets the length of widestring '''S''' as '''NewLength'''.
 +
|-
 +
| function '''Length'''(const S: Array): Integer;
 +
| Returns the length of array '''S'''
 +
|-
 +
| function '''Length'''(const S: String): Integer;
 +
| Returns the length of string '''S'''
 +
|-
 +
| function '''Length'''(const S: WideString): Integer;
 +
| Returns the length of widestring '''S'''
 +
|}
 +
 
 +
== Unicode String Handling Routines  ==
 +
 
 +
{| class="prettytable"
 +
|
 +
| <center>'''Remarks'''</center>
 +
 
 +
|-
 +
| procedure '''WideInsert'''(const Substr: WideString; var Dest: WideString; Index: Integer);
 +
| '''@@@'''
 +
 
 +
|-
 +
| procedure '''WideDelete'''(var S: WideString; Index, Count: Integer);
 +
| '''@@@'''
 +
 
 +
|-
 +
| procedure '''WideSetLength'''(var S: WideString; NewLength: Integer);
 +
| '''@@@'''
 +
 
 +
|-
 +
| function '''WideLength'''(const S: WideString): Integer;
 +
| Returns the length of WideString S. '''@@@units?'''
 +
 
 +
|-
 +
| function '''WideCopy'''(const S: WideString; Index, Count: Integer): WideString;
 +
| '''@@@'''
 +
 
 +
|-
 +
| function '''WidePos'''(const SubStr, S: WideString): Integer;
 +
| '''@@@'''
 +
 
 +
|-
 +
| function '''WidePosEx'''(const SubStr, S: WideString; Offset: Cardinal): Integer;
 +
| '''@@@'''
 +
 
 +
|-
 +
| function '''WideUpperCase'''(const S: WideString): WideString;
 +
| '''@@@'''
 +
 
 +
|-
 +
| function '''WideLowerCase'''(const S: WideString): WideString;
 +
|
 +
 
 +
|-
 +
| function '''WideCompareStr'''(const S1, S2: WideString): Integer;
 +
|
 +
 
 +
|-
 +
| function '''WideCompareText'''(const S1, S2: WideString): Integer;
 +
|
 +
 
 +
|-
 +
| function '''WideSameText'''(const S1, S2: WideString): Boolean;
 +
|
 +
 
 +
|-
 +
| function '''WideTextPos'''(const SubStr, S: WideString): Integer;
 +
|
 +
 
 +
|-
 +
| function '''WideTrim'''(const S: WideString): WideString;
 +
|
 +
 
 +
|-
 +
| function '''WideReplaceStr'''(const S, OldPattern, NewPattern: WideString): WideString;
 +
|
 +
 
 +
|-
 +
| function '''WideReplaceText'''(const S, OldPattern, NewPattern: WideString): WideString;
 +
|
 +
 
 +
|-
 +
| function '''WideSplitString'''(const Input, Delimiter: WideString): TStringsArray;
 +
|
 +
 
 +
|-
 +
| function '''WideCaseCapitalize'''(const S: WideString): WideString;
 +
|
 +
 
 +
|-
 +
| function '''WideCaseInvert'''(const S: WideString): WideString;
 +
|
 +
 
 +
|}
 +
 
 +
== Meta Tags Extraction  ==
 +
 
 +
{| class="prettytable"
 +
|
 +
| <center>'''Remarks'''</center>
 +
 
 +
|-
 +
| function '''CalculateMetaTag'''(const FilePath: WideString; const MetaTagName String): String;
 +
| Extracts and returns the metatag named '''MetaTagName''' from the file specified by the complete absolute path '''FilePath.'''
 +
 
 +
|}
 +
 
 +
== Regular Expressions  ==
 +
 
 +
{| class="prettytable"
 +
|
 +
| <center>'''Remarks'''</center>
 +
 
 +
|-
 +
| function '''ReplaceRegEx'''(const Input, Find, Replace: WideString;const CaseSensitive, UseSubstitution: Boolean): WideString;
 +
| Input - string to be processed by RegEx engine, eg. FileNameFind&nbsp; - equivalent for the field 'Expression' from the RegEx rule dialogReplace - well... 'Replace' from the RegEx rule dialogCaseSensitive - True/FalseUseSubstitution - determines whether use backreferences in result. If it is set to True, the function will change $1-$9 in 'Replace' string with the corresponding parts of 'Find' expression, eg. (.+). If it's set to False, function will print $1 as it is (eg. "My_Picture_$1" instead of "My_Picture_365") to the result string.
 +
 
 +
|-
 +
| function '''MatchesRegEx'''(const Input, Find: WideString;const CaseSensitive: Boolean): TStringsArray;
 +
|
 +
 
 +
|-
 +
| function '''SubMatchesRegEx'''(const Input, Find: WideString;const CaseSensitive: Boolean): TStringsArray;
 +
|
 +
 
 +
|}
 +
 
 +
== Unicode Character Handling Routines  ==
 +
 
 +
{| class="prettytable"
 +
|
 +
| <center>'''Remarks'''</center>
 +
 
 +
|-
 +
| function '''IsWideCharUpper'''(WC: WideChar): Boolean;
 +
| Checks a Unicode character '''WC''' and returns TRUE if it is in UPPERCASE.
  
procedure '''Delete'''(var S: String; Index, Count: Integer);
+
|-
 +
| function '''IsWideCharLower'''(WC: WideChar): Boolean;
 +
| Checks a Unicode character '''WC''' and returns TRUE if it is in lowercase
  
function '''Copy'''(S: String; Index, Count: Integer): String;
+
|-
 +
| function '''IsWideCharDigit'''(WC: WideChar): Boolean;
 +
| Checks a Unicode character '''WC''' and returns TRUE if it is a digit
  
function '''Pos'''(Substr: String; S: String): Integer;
+
(numeric character 0-9).
  
== Length Managing Routines ==
+
|-
 +
| function '''IsWideCharSpace'''(WC: WideChar): Boolean;
 +
| Checks a Unicode character '''WC''' and returns TRUE if it is a space.
  
procedure '''SetLength'''(var S: Array; NewLength: Integer);
+
|-
 +
| function '''IsWideCharPunct'''(WC: WideChar): Boolean;
 +
| Checks a Unicode character '''WC''' and returns TRUE if it is a punctuation mark.
  
procedure '''SetLength'''(var S: String; NewLength: Integer);
+
'''@@@ which are these??'''
  
procedure '''SetLength'''(var S: WideString; NewLength: Integer);
+
|-
 +
| function '''IsWideCharCntrl'''(WC: WideChar): Boolean;
 +
| Checks a Unicode character '''WC''' and returns TRUE if it is a control character. '''@@@ which are these??'''
  
function '''Length'''(const S: Array): Integer;
+
|-
 +
| function '''IsWideCharBlank'''(WC: WideChar): Boolean;
 +
| Checks a Unicode character '''WC''' and returns TRUE if it is a blank.
  
function '''Length'''(const S: String): Integer;
+
'''@@@ which are these?? '''
  
function '''Length'''(const S: WideString): Integer;
+
|-
 +
| function '''IsWideCharXDigit'''(WC: WideChar): Boolean;
 +
| '''@@@what is this function?'''
  
== Unicode String Handling Routines ==
+
|-
 +
| function '''IsWideCharAlpha'''(WC: WideChar): Boolean;
 +
| Checks a Unicode character '''WC''' and returns TRUE if it is a alphanumeric character (a-z or A-Z).
  
procedure '''WideInsert'''(const Substr: WideString; var Dest: WideString; Index: Integer);
+
|-
 +
| function '''IsWideCharAlphaNumeric'''(WC: WideChar): Boolean;
 +
| Checks a Unicode character '''WC''' and returns TRUE if it is a alphanumeric character or a numeric character (a-z, A-Z or 0-9).
  
procedure '''WideDelete'''(var S: WideString; Index, Count: Integer);
+
|-
 +
| function '''WideCharUpper'''(const WC: WideChar): WideChar;
 +
| Returns a UPPERCASE version of the input Unicode character. In case of non-alphabetic character, it returns the same character. '''@@@correct?'''
  
procedure '''WideSetLength'''(var S: WideString; NewLength: Integer);
+
|-
 +
| function '''WideCharLower'''(const WC: WideChar): WideChar;
 +
| Returns a lowercase version of the input Unicode character. In case of non-alphabetic character, it returns the same character. '''@@@correct?'''
  
function '''WideLength'''(const S: WideString): Integer;
+
|}
  
function '''WideCopy'''(const S: WideString; Index, Count: Integer): WideString;
+
== Unicode Conversion Routines  ==
  
function '''WidePos'''(const SubStr, S: WideString): Integer;
+
{| class="prettytable"
 +
|
 +
| <center>'''Remarks'''</center>
  
function '''WidePosEx'''(const SubStr, S: WideString; Offset: Cardinal): Integer;
+
|-
 +
| function '''WideToAnsi'''(const WS: WideString): String;
 +
| Converts a Unicode string to its ANSI version.
  
function '''WideUpperCase'''(const S: WideString): WideString;
+
'''@@@ Is this a single character or an entire string that has multiple characters?'''
  
function '''WideLowerCase'''(const S: WideString): WideString;
+
|-
 +
| function '''AnsiToWide'''(const S: String): WideString;
 +
| Converts a ANSI string to its ANSI Unicode version.
  
function '''WideCompareStr'''(const S1, S2: WideString): Integer;
+
'''@@@ Is this a single character or an entire string that has multiple characters?'''
  
function '''WideCompareText'''(const S1, S2: WideString): Integer;
+
|-
 +
| function '''UTF8Encode'''(const WS: WideString): String;
 +
|
  
function '''WideSameText'''(const S1, S2: WideString): Boolean;
+
|-
 +
| function '''UTF8Decode'''(const S: String): WideString;
 +
|
  
function '''WideTextPos'''(const SubStr, S: WideString): Integer;
+
|}
  
function '''WideTrim'''(const S: WideString): WideString;
 
  
function '''WideReplaceStr'''(const S, OldPattern, NewPattern: WideString): WideString;
+
== Basic Conversion Routines  ==
  
function '''WideReplaceText'''(const S, OldPattern, NewPattern: WideString): WideString;
+
{| class="prettytable"
 +
|
 +
| <center>'''Remarks'''</center>
  
function '''WideSplitString'''(const Input, Delimiter: WideString): TStringsArray;
+
|-
 +
| function '''IntToStr'''(Value: Integer): String;
 +
| Converts an integer to a string'''@@@ how exactly?'''
  
function '''WideCaseCapitalize'''(const S: WideString): WideString;
+
|-
 +
| function '''StrToInt'''(const S: String): Integer;
 +
| Converts a string to an integer.
  
function '''WideCaseInvert'''(const S: WideString): WideString;
+
'''@@@ how exactly?'''
  
== Meta Tags Extraction ==
+
|-
 +
| function '''StrToIntDef'''(const S: String; const Default: Integer): Integer;
 +
|
  
function '''CalculateMetaTag'''(const FilePath: WideString; const MetaTagName String): String;
+
|-
 +
| function '''DateToStr'''(D: TDateTime): String;
 +
| Converts a date to an string.
  
== Regular Expressions ==
+
'''@@@ how exactly? What formats are used? How to specify them?'''
  
function '''ReplaceRegEx'''(const Input, Find, Replace: WideString; const CaseSensitive, UseSubstitution: Boolean): WideString;
+
|-
 +
| function '''StrToDate'''(const S: String): TDateTime;
 +
| Converts a string to an date.
  
function '''MatchesRegEx'''(const Input, Find: WideString; const CaseSensitive: Boolean): TStringsArray;
+
'''@@@ how exactly? What is the required input format?'''
  
function '''SubMatchesRegEx'''(const Input, Find: WideString; const CaseSensitive: Boolean): TStringsArray;
+
|-
 +
| function '''IntToHex'''(Value: Integer; Digits: Integer): String;
 +
| Converts an integer to its Hexadecimal value.
  
== Unicode Character Handling Routines ==
+
'''@@@ how is the hex string formatted? '''
  
function '''IsWideCharUpper'''(WC: WideChar): Boolean;
+
|-
 +
| function '''HexToInt'''(const HexNum: String): Integer;
 +
| Converts a Hexadecimal value to its decimal (base 10) value.
  
function '''IsWideCharLower'''(WC: WideChar): Boolean;
+
'''@@@ how is the hex string formatted? '''
  
function '''IsWideCharDigit'''(WC: WideChar): Boolean;
+
|-
 +
| function '''HexToIntDef'''(const HexNum: String; Default: Integer): Integer;
 +
|
  
function '''IsWideCharSpace'''(WC: WideChar): Boolean;
+
|-
 +
| function '''Chr'''(X: Byte): Char;
 +
|
  
function '''IsWideCharPunct'''(WC: WideChar): Boolean;
+
|-
 +
| function '''Ord'''(X: Char): Byte;
 +
|
  
function '''IsWideCharCntrl'''(WC: WideChar): Boolean;
+
|}
  
function '''IsWideCharBlank'''(WC: WideChar): Boolean;
 
  
function '''IsWideCharXDigit'''(WC: WideChar): Boolean;
+
== Date And Time Routines  ==
  
function '''IsWideCharAlpha'''(WC: WideChar): Boolean;
+
{| class="prettytable"
 +
|
 +
| <center>'''Remarks'''</center>
  
function '''IsWideCharAlphaNumeric'''(WC: WideChar): Boolean;
+
|-
 +
| function '''Date''': TDateTime;
 +
|
  
function '''WideCharUpper'''(const WC: WideChar): WideChar;
+
|-
 +
| function '''Time''': TDateTime;
 +
|
  
function '''WideCharLower'''(const WC: WideChar): WideChar;
+
|-
 +
| function '''Now''': TDateTime;
 +
|
  
== Unicode Conversion Routines ==
+
|-
 +
| function '''EncodeDate'''(Year, Month, Day: Word): TDateTime;
 +
|
  
function '''WideToAnsi'''(const WS: WideString): String;
+
|-
 +
| function '''EncodeTime'''(Hour, Min, Sec, MSec: Word): TDateTime;
 +
|
  
function '''AnsiToWide'''(const S: String): WideString;
+
|-
 +
| function '''TryEncodeDate'''(Year, Month, Day: Word; var Date: TDateTime): Boolean;
 +
|
  
function '''UTF8Encode'''(const WS: WideString): String;
+
|-
 +
| function '''TryEncodeTime'''(Hour, Min, Sec, MSec: Word; var Time: TDateTime): Boolean;
 +
|
  
function '''UTF8Decode'''(const S: String): WideString;
+
|-
 +
| procedure '''DecodeDate'''(const DateTime: TDateTime; var Year, Month, Day: Word);
 +
|
  
== Basic Conversion Routines ==
+
|-
 +
| procedure '''DecodeTime'''(const DateTime: TDateTime; var Hour, Min, Sec, MSec: Word);
 +
|
  
function '''IntToStr'''(Value: Integer): String;
+
|-
 +
| function '''DayOfWeek'''(const DateTime: TDateTime): Word;
 +
|
  
function '''StrToInt'''(const S: String): Integer;
+
|-
 +
| function '''DateTimeToUnix'''(D: TDateTime): Int64;
 +
|
  
function '''StrToIntDef'''(const S: String; const Default: Integer): Integer;
+
|-
 +
| function '''UnixToDateTime'''(U: Int64): TDateTime;
 +
|
  
function '''DateToStr'''(D: TDateTime): String;
+
|-
 +
| function '''FormatDateTime'''(const fmt: String; D: TDateTime): String;
 +
|
  
function '''StrToDate'''(const S: String): TDateTime;
+
|-
 +
| function '''IncYear'''(const AValue: TDateTime;const ANumberOfYears: Integer): TDateTime;
 +
|
  
function '''IntToHex'''(Value: Integer; Digits: Integer): String;
+
|-
 +
| function '''IncMonth'''(const AValue: TDateTime;ANumberOfMonths: Integer): TDateTime;
 +
|
  
function '''HexToInt'''(const HexNum: String): Integer;
+
|-
 +
| function '''IncWeek'''(const AValue: TDateTime;
 +
|
  
function '''HexToIntDef'''(const HexNum: String; Default: Integer): Integer;
+
|-
 +
| const ANumberOfWeeks: Integer): TDateTime;
 +
|
  
function '''Chr'''(X: Byte): Char;
+
|-
 +
| function '''IncDay'''(const AValue: TDateTime;const ANumberOfDays: Integer): TDateTime;
 +
|
  
function '''Ord'''(X: Char): Byte;
+
|-
 +
| function '''IncHour'''(const AValue: TDateTime;const ANumberOfHours: Int64): TDateTime;
 +
|
  
== Date And Time Routines ==
+
|-
 +
| function '''IncMinute'''(const AValue: TDateTime;const ANumberOfMinutes: Int64): TDateTime;
 +
|
  
function '''Date''': TDateTime;
+
|-
 +
| function '''IncSecond'''(const AValue: TDateTime;const ANumberOfSeconds: Int64): TDateTime;
 +
|
 +
 
 +
|-
 +
| function '''IncMilliSecond'''(const AValue: TDateTime;const ANumberOfMilliSeconds: Int64): TDateTime;
 +
|
 +
 
 +
|}
  
function '''Time''': TDateTime;
 
  
function '''Now''': TDateTime;
+
== File Management Routines  ==
  
function '''EncodeDate'''(Year, Month, Day: Word): TDateTime;
+
{| class="prettytable"
 +
|
 +
| <center>'''Remarks'''</center>
  
function '''EncodeTime'''(Hour, Min, Sec, MSec: Word): TDateTime;
+
|-
 +
| function '''WideFileSize'''(const FileName: WideString): Int64;
 +
|
  
function '''TryEncodeDate'''(Year, Month, Day: Word; var Date: TDateTime): Boolean;
+
|-
 +
| function '''WideFileExists'''(const FileName: WideString): Boolean;
 +
|
  
function '''TryEncodeTime'''(Hour, Min, Sec, MSec: Word; var Time: TDateTime): Boolean;
+
|-
 +
| function '''WideDirectoryExists'''(const Directory: WideString): Boolean;
 +
|
  
procedure '''DecodeDate'''(const DateTime: TDateTime; var Year, Month, Day: Word);
+
|-
 +
| function '''WideForceDirectories'''(Dir: WideString): Boolean;
 +
|
  
procedure '''DecodeTime'''(const DateTime: TDateTime; var Hour, Min, Sec, MSec: Word);
+
|-
 +
| function '''WideCreateDir'''(const Dir: WideString): Boolean;
 +
|
  
function '''DayOfWeek'''(const DateTime: TDateTime): Word;
+
|-
 +
| function '''WideDeleteFile'''(const FileName: WideString): Boolean;
 +
|
  
function '''DateTimeToUnix'''(D: TDateTime): Int64;
+
|-
 +
| function '''WideRenameFile'''(const OldName, NewName: WideString): Boolean;
 +
|
  
function '''UnixToDateTime'''(U: Int64): TDateTime;
+
|-
 +
| function '''WideFileSearch'''(const Name, DirList: WideString): WideString;
 +
|
  
function '''FormatDateTime'''(const fmt: String; D: TDateTime): String;
+
|-
 +
| function '''WideGetCurrentDir''': WideString;
 +
|
  
function '''IncYear'''(const AValue: TDateTime; const ANumberOfYears: Integer): TDateTime;
+
|-
 +
| function '''WideSetCurrentDir'''(const Dir: WideString): Boolean;
 +
|
  
function '''IncMonth'''(const AValue: TDateTime; ANumberOfMonths: Integer): TDateTime;
+
|-
 +
| procedure '''WideScanDirForFiles'''(Dir: WideString; var Files: TStringsArray;const Recursive, IncludeHidden, IncludeSystem: Boolean; const Mask: WideString);
 +
|
  
function '''IncWeek'''(const AValue: TDateTime; const ANumberOfWeeks: Integer): TDateTime;
+
|-
 +
| procedure '''WideScanDirForFolders'''(Dir: WideString; var Folders: TStringsArray;const Recursive, IncludeHidden, IncludeSystem: Boolean);
 +
|
  
function '''IncDay'''(const AValue: TDateTime; const ANumberOfDays: Integer): TDateTime;
+
|}
  
function '''IncHour'''(const AValue: TDateTime; const ANumberOfHours: Int64): TDateTime;
 
  
function '''IncMinute'''(const AValue: TDateTime; const ANumberOfMinutes: Int64): TDateTime;
+
== File Name Utilities  ==
  
function '''IncSecond'''(const AValue: TDateTime; const ANumberOfSeconds: Int64): TDateTime;
+
{| class="prettytable"
 +
|
 +
| <center>'''Remarks'''</center>
  
function '''IncMilliSecond'''(const AValue: TDateTime; const ANumberOfMilliSeconds: Int64): TDateTime;
+
|-
 +
| function '''WideExtractFilePath'''(const FileName: WideString): WideString;
 +
|
  
== File Management Routines ==
+
|-
 +
| function '''WideExtractFileDir'''(const FileName: WideString): WideString;
 +
|
  
function '''WideFileSize'''(const FileName: WideString): Int64;
+
|-
 +
| function '''WideExtractFileDrive'''(const FileName: WideString): WideString;
 +
|
  
function '''WideFileExists'''(const FileName: WideString): Boolean;
+
|-
 +
| function '''WideExtractFileName'''(const FileName: WideString): WideString;
 +
|
  
function '''WideDirectoryExists'''(const Directory: WideString): Boolean;
+
|-
 +
| function '''WideExtractBaseName'''(const FileName: WideString): WideString;
 +
|
  
function '''WideForceDirectories'''(Dir: WideString): Boolean;
+
|-
 +
| function '''WideExtractFileExt'''(const FileName: WideString): WideString;
 +
|
  
function '''WideCreateDir'''(const Dir: WideString): Boolean;
+
|-
 +
| function '''WideChangeFileExt'''(const FileName, Extension: WideString): WideString;
 +
|
  
function '''WideDeleteFile'''(const FileName: WideString): Boolean;
+
|-
 +
| function '''WideStripExtension'''(const FileName: WideString): WideString;
 +
|
  
function '''WideRenameFile'''(const OldName, NewName: WideString): Boolean;
+
|-
 +
| function '''WideExpandFileName'''(const FileName: WideString): WideString;
 +
|
  
function '''WideFileSearch'''(const Name, DirList: WideString): WideString;
+
|-
 +
| function '''WideExtractRelativePath'''(const BaseName, DestName: WideString): WideString;
 +
|
  
function '''WideGetCurrentDir''': WideString;
+
|-
 +
| function '''WideExtractShortPathName'''(const FileName: WideString): WideString;
 +
|
  
function '''WideSetCurrentDir'''(const Dir: WideString): Boolean;
+
|-
 +
| function '''WideIncludeTrailingPathDelimiter'''(const S: WideString): WideString;
 +
|
  
procedure '''WideScanDirForFiles'''(Dir: WideString; var Files: TStringsArray; const Recursive, IncludeHidden, IncludeSystem: Boolean; const Mask: WideString);
+
|-
 +
| function '''WideExcludeTrailingPathDelimiter'''(const S: WideString): WideString;
 +
|
  
procedure '''WideScanDirForFolders'''(Dir: WideString; var Folders: TStringsArray; const Recursive, IncludeHidden, IncludeSystem: Boolean);
+
|-
 +
| function '''WideSameFileName'''(const S1, S2: WideString): Boolean;
 +
|
  
== File Name Utilities ==
+
|-
 +
| function '''WideGetEnvironmentVar'''(const VarName: WideString): WideString;
 +
|
  
function '''WideExtractFilePath'''(const FileName: WideString): WideString;
+
|}
  
function '''WideExtractFileDir'''(const FileName: WideString): WideString;
 
  
function '''WideExtractFileDrive'''(const FileName: WideString): WideString;
+
== File Read/Write Routines  ==
  
function '''WideExtractFileName'''(const FileName: WideString): WideString;
+
{| class="prettytable"
 +
|
 +
| <center>'''Remarks'''</center>
  
function '''WideExtractBaseName'''(const FileName: WideString): WideString;
+
|-
 +
| function '''FileReadFragment'''(const FileName: WideString; Start, Length: Integer): String;
 +
|
  
function '''WideExtractFileExt'''(const FileName: WideString): WideString;
+
|-
 +
| function '''FileReadLine'''(const FileName: WideString; LineNum: Integer): String;
 +
|
  
function '''WideChangeFileExt'''(const FileName, Extension: WideString): WideString;
+
|-
 +
| function '''FileCountLines'''(const FileName: WideString): Integer;
 +
|
  
function '''WideStripExtension'''(const FileName: WideString): WideString;
+
|-
 +
| function '''FileReadContent'''(const FileName: WideString): String;
 +
|
  
function '''WideExpandFileName'''(const FileName: WideString): WideString;
+
|-
 +
| procedure '''FileWriteContent'''(const FileName: WideString; const Content: String);
 +
|
  
function '''WideExtractRelativePath'''(const BaseName, DestName: WideString): WideString;
+
|-
 +
| procedure '''FileAppendContent'''(const FileName: WideString; const Content: String);
 +
|
  
function '''WideExtractShortPathName'''(const FileName: WideString): WideString;
+
|}
  
function '''WideIncludeTrailingPathDelimiter'''(const S: WideString): WideString;
 
  
function '''WideExcludeTrailingPathDelimiter'''(const S: WideString): WideString;
+
== File Properties Routines  ==
  
function '''WideSameFileName'''(const S1, S2: WideString): Boolean;
+
{| class="prettytable"
 +
|
 +
| <center>'''Remarks'''</center>
  
function '''WideGetEnvironmentVar'''(const VarName: WideString): WideString;
+
|-
 +
| function '''FileTimeModified'''(const FileName: WideString): TDateTime;
 +
|
  
== File Read/Write Routines ==
+
|-
 +
| function '''FileTimeCreated'''(const FileName: WideString): TDateTime;
 +
|
  
function '''FileReadFragment'''(const FileName: WideString; Start, Length: Integer): String;
+
|-
 +
| function '''SetFileTimeCreated'''(const FileName: WideString;const DateTime: TDateTime): Boolean;
 +
|
  
function '''FileReadLine'''(const FileName: WideString; LineNum: Integer): String;
+
|-
 +
| function '''SetFileTimeModified'''(const FileName: WideString;const DateTime: TDateTime): Boolean;
 +
|
  
function '''FileCountLines'''(const FileName: WideString): Integer;
+
|}
  
function '''FileReadContent'''(const FileName: WideString): String;
 
  
procedure '''FileWriteContent'''(const FileName: WideString; const Content: String);
+
== Process Execution Routines  ==
  
procedure '''FileAppendContent'''(const FileName: WideString; const Content: String);
+
{| class="prettytable"
 +
|
 +
| <center>'''Remarks'''</center>
  
== File Properties Routines ==
+
|-
 +
| function '''ShellOpenFile'''(const FileName: WideString): Boolean;
 +
|
  
function '''FileTimeModified'''(const FileName: WideString): TDateTime;
+
|-
 +
| function '''ExecuteProgram'''(const Command: String; WaitForProgram: Boolean): Cardinal;
 +
|
  
function '''FileTimeCreated'''(const FileName: WideString): TDateTime;
+
|-
 +
| function '''ExecConsoleApp'''(const CommandLine: String; out Output: String): Cardinal;
 +
|
  
function '''SetFileTimeCreated'''(const FileName: WideString; const DateTime: TDateTime): Boolean;
+
|}
 +
  
function '''SetFileTimeModified'''(const FileName: WideString; const DateTime: TDateTime): Boolean;
+
== Interactive Dialogs  ==
  
== Process Execution Routines ==
+
{| class="prettytable"
 +
|
 +
| <center>'''Remarks'''</center>
  
function '''ShellOpenFile'''(const FileName: WideString): Boolean;
+
|-
 +
| procedure '''ShowMessage'''(const Msg: String);
 +
|
  
function '''ExecuteProgram'''(const Command: String; WaitForProgram: Boolean): Cardinal;
+
|-
 +
| procedure '''WideShowMessage'''(const Msg: WideString);
 +
|
  
function '''ExecConsoleApp'''(const CommandLine: String; out Output: String): Cardinal;
+
|-
 +
| function '''DialogYesNo'''(const Msg: String): Boolean;
 +
|
  
== Interactive Dialogs ==
+
|-
 +
| function '''WideDialogYesNo'''(const Msg: WideString): Boolean;
 +
|
  
procedure '''ShowMessage'''(const Msg: String);
+
|-
 +
| function '''InputBox'''(const ACaption, APrompt, ADefault: String): String;
 +
|
  
procedure '''WideShowMessage'''(const Msg: WideString);
+
|-
 +
| function '''InputQuery'''(const ACaption, APrompt: String; var Value: String): Boolean;
 +
|
  
function '''DialogYesNo'''(const Msg: String): Boolean;
+
|-
 +
| function '''WideInputBox'''(const ACaption, APrompt, ADefault: WideString): WideString;
 +
|
  
function '''WideDialogYesNo'''(const Msg: WideString): Boolean;
+
|-
 +
| function '''WideInputQuery'''(const ACaption, APrompt: WideString;var Value: WideString): Boolean;
 +
|
  
function '''InputBox'''(const ACaption, APrompt, ADefault: String): String;
+
|}
  
function '''InputQuery'''(const ACaption, APrompt: String; var Value: String): Boolean;
 
  
function '''WideInputBox'''(const ACaption, APrompt, ADefault: WideString): WideString;
+
== Other Routines  ==
  
function '''WideInputQuery'''(const ACaption, APrompt: WideString; var Value: WideString): Boolean;
+
{| class="prettytable"
 +
|
 +
| <center>'''Remarks'''</center>
  
== Other Routines ==
+
|-
 +
| procedure '''Randomize'''();
 +
|
  
procedure '''Randomize'''();
+
|-
 +
| procedure '''Sleep'''(Milliseconds: Cardinal);
 +
| Sleeps (waits) for specified miliseconds
  
procedure '''Sleep'''(Milliseconds: Cardinal);
+
|-
 +
| procedure '''DivMod'''(Dividend: Integer; Divisor: Word; var Result, Remainder: Word);
 +
|
  
procedure '''DivMod'''(Dividend: Integer; Divisor: Word; var Result, Remainder: Word);
+
|-
 +
| procedure '''SetClipboardText'''(const S: WideString);
 +
|
  
procedure '''SetClipboardText'''(const S: WideString);
+
|-
 +
| function '''GetClipboardText''': WideString;
 +
|
  
function '''GetClipboardText''': WideString;
+
|-
 +
| function '''RandomRange'''(const AFrom, ATo: Integer): Integer;
 +
|
  
function '''RandomRange'''(const AFrom, ATo: Integer): Integer;
+
|-
 +
| function '''Base64Encode'''(const S: String): String;
 +
|
  
function '''Base64Encode'''(const S: String): String;
+
|-
 +
| function '''Base64Decode'''(const S: String): String;
 +
|
  
function '''Base64Decode'''(const S: String): String;
+
|-
 +
| function '''GetTickCount''': Cardinal;
 +
|
  
function '''GetTickCount''': Cardinal;
+
|-
 +
| function '''SizeOf'''(X): Integer;
 +
|
  
function '''SizeOf'''(X): Integer;
+
|}

Revision as of 13:53, 11 July 2009

Basic String Handling Routines

procedure Insert(Source: String; var S: String; Index: Integer); Inserts the string S into string Source at position Index.
procedure Delete(var S: String; Index, Count: Integer); Deletes Count characters from the string S, starting from position Index.
function Copy(S: String; Index, Count: Integer): String; Copies Count characters from string S,.starting at position Index. and returns them as a string.
function Pos(Substr: String; S: String): Integer; Returns the position of a string Substr in another string S,


Length Managing Routines

Remarks
procedure SetLength(var S: Array; NewLength: Integer); Sets the length of array variable S as NewLength.
procedure SetLength(var S: String; NewLength: Integer); Sets the length of string variable S as NewLength.
procedure SetLength(var S: WideString; NewLength: Integer); Sets the length of widestring S as NewLength.
function Length(const S: Array): Integer; Returns the length of array S
function Length(const S: String): Integer; Returns the length of string S
function Length(const S: WideString): Integer; Returns the length of widestring S

Unicode String Handling Routines

Remarks
procedure WideInsert(const Substr: WideString; var Dest: WideString; Index: Integer); @@@
procedure WideDelete(var S: WideString; Index, Count: Integer); @@@
procedure WideSetLength(var S: WideString; NewLength: Integer); @@@
function WideLength(const S: WideString): Integer; Returns the length of WideString S. @@@units?
function WideCopy(const S: WideString; Index, Count: Integer): WideString; @@@
function WidePos(const SubStr, S: WideString): Integer; @@@
function WidePosEx(const SubStr, S: WideString; Offset: Cardinal): Integer; @@@
function WideUpperCase(const S: WideString): WideString; @@@
function WideLowerCase(const S: WideString): WideString;
function WideCompareStr(const S1, S2: WideString): Integer;
function WideCompareText(const S1, S2: WideString): Integer;
function WideSameText(const S1, S2: WideString): Boolean;
function WideTextPos(const SubStr, S: WideString): Integer;
function WideTrim(const S: WideString): WideString;
function WideReplaceStr(const S, OldPattern, NewPattern: WideString): WideString;
function WideReplaceText(const S, OldPattern, NewPattern: WideString): WideString;
function WideSplitString(const Input, Delimiter: WideString): TStringsArray;
function WideCaseCapitalize(const S: WideString): WideString;
function WideCaseInvert(const S: WideString): WideString;

Meta Tags Extraction

Remarks
function CalculateMetaTag(const FilePath: WideString; const MetaTagName String): String; Extracts and returns the metatag named MetaTagName from the file specified by the complete absolute path FilePath.

Regular Expressions

Remarks
function ReplaceRegEx(const Input, Find, Replace: WideString;const CaseSensitive, UseSubstitution: Boolean): WideString; Input - string to be processed by RegEx engine, eg. FileNameFind  - equivalent for the field 'Expression' from the RegEx rule dialogReplace - well... 'Replace' from the RegEx rule dialogCaseSensitive - True/FalseUseSubstitution - determines whether use backreferences in result. If it is set to True, the function will change $1-$9 in 'Replace' string with the corresponding parts of 'Find' expression, eg. (.+). If it's set to False, function will print $1 as it is (eg. "My_Picture_$1" instead of "My_Picture_365") to the result string.
function MatchesRegEx(const Input, Find: WideString;const CaseSensitive: Boolean): TStringsArray;
function SubMatchesRegEx(const Input, Find: WideString;const CaseSensitive: Boolean): TStringsArray;

Unicode Character Handling Routines

Remarks
function IsWideCharUpper(WC: WideChar): Boolean; Checks a Unicode character WC and returns TRUE if it is in UPPERCASE.
function IsWideCharLower(WC: WideChar): Boolean; Checks a Unicode character WC and returns TRUE if it is in lowercase
function IsWideCharDigit(WC: WideChar): Boolean; Checks a Unicode character WC and returns TRUE if it is a digit

(numeric character 0-9).

function IsWideCharSpace(WC: WideChar): Boolean; Checks a Unicode character WC and returns TRUE if it is a space.
function IsWideCharPunct(WC: WideChar): Boolean; Checks a Unicode character WC and returns TRUE if it is a punctuation mark.

@@@ which are these??

function IsWideCharCntrl(WC: WideChar): Boolean; Checks a Unicode character WC and returns TRUE if it is a control character. @@@ which are these??
function IsWideCharBlank(WC: WideChar): Boolean; Checks a Unicode character WC and returns TRUE if it is a blank.

@@@ which are these??

function IsWideCharXDigit(WC: WideChar): Boolean; @@@what is this function?
function IsWideCharAlpha(WC: WideChar): Boolean; Checks a Unicode character WC and returns TRUE if it is a alphanumeric character (a-z or A-Z).
function IsWideCharAlphaNumeric(WC: WideChar): Boolean; Checks a Unicode character WC and returns TRUE if it is a alphanumeric character or a numeric character (a-z, A-Z or 0-9).
function WideCharUpper(const WC: WideChar): WideChar; Returns a UPPERCASE version of the input Unicode character. In case of non-alphabetic character, it returns the same character. @@@correct?
function WideCharLower(const WC: WideChar): WideChar; Returns a lowercase version of the input Unicode character. In case of non-alphabetic character, it returns the same character. @@@correct?

Unicode Conversion Routines

Remarks
function WideToAnsi(const WS: WideString): String; Converts a Unicode string to its ANSI version.

@@@ Is this a single character or an entire string that has multiple characters?

function AnsiToWide(const S: String): WideString; Converts a ANSI string to its ANSI Unicode version.

@@@ Is this a single character or an entire string that has multiple characters?

function UTF8Encode(const WS: WideString): String;
function UTF8Decode(const S: String): WideString;


Basic Conversion Routines

Remarks
function IntToStr(Value: Integer): String; Converts an integer to a string@@@ how exactly?
function StrToInt(const S: String): Integer; Converts a string to an integer.

@@@ how exactly?

function StrToIntDef(const S: String; const Default: Integer): Integer;
function DateToStr(D: TDateTime): String; Converts a date to an string.

@@@ how exactly? What formats are used? How to specify them?

function StrToDate(const S: String): TDateTime; Converts a string to an date.

@@@ how exactly? What is the required input format?

function IntToHex(Value: Integer; Digits: Integer): String; Converts an integer to its Hexadecimal value.

@@@ how is the hex string formatted?

function HexToInt(const HexNum: String): Integer; Converts a Hexadecimal value to its decimal (base 10) value.

@@@ how is the hex string formatted?

function HexToIntDef(const HexNum: String; Default: Integer): Integer;
function Chr(X: Byte): Char;
function Ord(X: Char): Byte;


Date And Time Routines

Remarks
function Date: TDateTime;
function Time: TDateTime;
function Now: TDateTime;
function EncodeDate(Year, Month, Day: Word): TDateTime;
function EncodeTime(Hour, Min, Sec, MSec: Word): TDateTime;
function TryEncodeDate(Year, Month, Day: Word; var Date: TDateTime): Boolean;
function TryEncodeTime(Hour, Min, Sec, MSec: Word; var Time: TDateTime): Boolean;
procedure DecodeDate(const DateTime: TDateTime; var Year, Month, Day: Word);
procedure DecodeTime(const DateTime: TDateTime; var Hour, Min, Sec, MSec: Word);
function DayOfWeek(const DateTime: TDateTime): Word;
function DateTimeToUnix(D: TDateTime): Int64;
function UnixToDateTime(U: Int64): TDateTime;
function FormatDateTime(const fmt: String; D: TDateTime): String;
function IncYear(const AValue: TDateTime;const ANumberOfYears: Integer): TDateTime;
function IncMonth(const AValue: TDateTime;ANumberOfMonths: Integer): TDateTime;
function IncWeek(const AValue: TDateTime;
const ANumberOfWeeks: Integer): TDateTime;
function IncDay(const AValue: TDateTime;const ANumberOfDays: Integer): TDateTime;
function IncHour(const AValue: TDateTime;const ANumberOfHours: Int64): TDateTime;
function IncMinute(const AValue: TDateTime;const ANumberOfMinutes: Int64): TDateTime;
function IncSecond(const AValue: TDateTime;const ANumberOfSeconds: Int64): TDateTime;
function IncMilliSecond(const AValue: TDateTime;const ANumberOfMilliSeconds: Int64): TDateTime;


File Management Routines

Remarks
function WideFileSize(const FileName: WideString): Int64;
function WideFileExists(const FileName: WideString): Boolean;
function WideDirectoryExists(const Directory: WideString): Boolean;
function WideForceDirectories(Dir: WideString): Boolean;
function WideCreateDir(const Dir: WideString): Boolean;
function WideDeleteFile(const FileName: WideString): Boolean;
function WideRenameFile(const OldName, NewName: WideString): Boolean;
function WideFileSearch(const Name, DirList: WideString): WideString;
function WideGetCurrentDir: WideString;
function WideSetCurrentDir(const Dir: WideString): Boolean;
procedure WideScanDirForFiles(Dir: WideString; var Files: TStringsArray;const Recursive, IncludeHidden, IncludeSystem: Boolean; const Mask: WideString);
procedure WideScanDirForFolders(Dir: WideString; var Folders: TStringsArray;const Recursive, IncludeHidden, IncludeSystem: Boolean);


File Name Utilities

Remarks
function WideExtractFilePath(const FileName: WideString): WideString;
function WideExtractFileDir(const FileName: WideString): WideString;
function WideExtractFileDrive(const FileName: WideString): WideString;
function WideExtractFileName(const FileName: WideString): WideString;
function WideExtractBaseName(const FileName: WideString): WideString;
function WideExtractFileExt(const FileName: WideString): WideString;
function WideChangeFileExt(const FileName, Extension: WideString): WideString;
function WideStripExtension(const FileName: WideString): WideString;
function WideExpandFileName(const FileName: WideString): WideString;
function WideExtractRelativePath(const BaseName, DestName: WideString): WideString;
function WideExtractShortPathName(const FileName: WideString): WideString;
function WideIncludeTrailingPathDelimiter(const S: WideString): WideString;
function WideExcludeTrailingPathDelimiter(const S: WideString): WideString;
function WideSameFileName(const S1, S2: WideString): Boolean;
function WideGetEnvironmentVar(const VarName: WideString): WideString;


File Read/Write Routines

Remarks
function FileReadFragment(const FileName: WideString; Start, Length: Integer): String;
function FileReadLine(const FileName: WideString; LineNum: Integer): String;
function FileCountLines(const FileName: WideString): Integer;
function FileReadContent(const FileName: WideString): String;
procedure FileWriteContent(const FileName: WideString; const Content: String);
procedure FileAppendContent(const FileName: WideString; const Content: String);


File Properties Routines

Remarks
function FileTimeModified(const FileName: WideString): TDateTime;
function FileTimeCreated(const FileName: WideString): TDateTime;
function SetFileTimeCreated(const FileName: WideString;const DateTime: TDateTime): Boolean;
function SetFileTimeModified(const FileName: WideString;const DateTime: TDateTime): Boolean;


Process Execution Routines

Remarks
function ShellOpenFile(const FileName: WideString): Boolean;
function ExecuteProgram(const Command: String; WaitForProgram: Boolean): Cardinal;
function ExecConsoleApp(const CommandLine: String; out Output: String): Cardinal;


Interactive Dialogs

Remarks
procedure ShowMessage(const Msg: String);
procedure WideShowMessage(const Msg: WideString);
function DialogYesNo(const Msg: String): Boolean;
function WideDialogYesNo(const Msg: WideString): Boolean;
function InputBox(const ACaption, APrompt, ADefault: String): String;
function InputQuery(const ACaption, APrompt: String; var Value: String): Boolean;
function WideInputBox(const ACaption, APrompt, ADefault: WideString): WideString;
function WideInputQuery(const ACaption, APrompt: WideString;var Value: WideString): Boolean;


Other Routines

Remarks
procedure Randomize();
procedure Sleep(Milliseconds: Cardinal); Sleeps (waits) for specified miliseconds
procedure DivMod(Dividend: Integer; Divisor: Word; var Result, Remainder: Word);
procedure SetClipboardText(const S: WideString);
function GetClipboardText: WideString;
function RandomRange(const AFrom, ATo: Integer): Integer;
function Base64Encode(const S: String): String;
function Base64Decode(const S: String): String;
function GetTickCount: Cardinal;
function SizeOf(X): Integer;