# Unit bbutils

Description
Uses
Classes, Interfaces, Objects and Records
Functions and Procedures
Types
Constants
Variables

## Description

This unit contains some basic functions missing in FreePascal.

There are different groups of functions and objects:

- TPointerView, TPCharView, TStringView: Stack objects to access a slice of an array or string.

- TStrBuilder: Stack object to create a string.

- Functions with prefix `str`, which are functions to compare or manipulate strings and pchars.

  The overloads for pchars are provided, so you can work with slices of strings without copying them. The prefix `strl` means the string length is given.

  The prefix `str?i` means the function is case-insensitive.

  These functions are rather outdated, since you can use the TPCharView for these tasks. But they will not be removed for backwards compatibility, and because they should be faster than views (because FPC can keep function parameters in registers, but not objects). And not all functions have been implemented for the view so far.

- Functions with prefix `date` and `time` , which are functions to parse and format date/time strings.

- Functions with prefix `arrays` to work on dynamic arrays.

  If the suffix `Fast` is given, the length of the array is different of the count of contained elements i.e. the standard length is actually a capacity so you can resize it without reallocating the array.
  Some array functions have two optional slice parameters: if you give none of them the function will affect the whole array; if you give one of them, the function will affect elements in the inclusive interval [0, slice] and if you give both, it will affect elements in the inclusive interval [slice1, slice2].

- Various math functions like binomial, modPow, intSieveEulerPhi. They were primarily implemented to solve competitive programming tasks.

String Encodings:

Most functions are encoding-agnostic and work on CP_ACP strings, they have `string` arguments and return `string`.
It is recommended to use the LCL mode with CP_ACP = CP_UTF8, but it is not required.
Functions only working on utf-8 take `RawByteString` arguments and return `UTF8String`. They do not take UTF8String arguments as that type behaves weirdly with utf-8 in other string types.
Functions that depend on the encoding and are encoding aware, like encoding conversions, take `RawByteString` arguments and return `RawByteString`.
pchars are assumed to have CP_ACP encoding.

## Overview

### Classes, Interfaces, Objects and Records

Name | Description
--- | ---
Object `TPointerView` | An array view representing a slice (subsequence) of an array.
Class `EDecodeHTMLEntitiesException` |
Record `TStrIterator` | Str iterator.
Record `TUTF8StringCodePointBlockEnumerator` | Enumerator for utf-8 codepoints in a string.
Object `TStrBuilder` | String builder to create strings
Object `TPCharView` | A string view representing a subsequence of a string or pchar or char array.
Object `TStringView` | A string view representing a subsequence of a string
Object `TBaseArrayList` |
Object `TCopyingArrayList` |
Object `TCopyingPtrArrayList` |
Object `TRecordArrayList` |
Class `EDateTimeParsingException` |

### Functions and Procedures

`function procedureToMethod(proc: TProcedure): TMethod;`
`function makeMethod(code, data: pointer): TMethod; inline;`
`function PtrToUInt(p: pointer): UIntPtr; inline;`
`function UIntToPtr(i: UIntPtr): pointer; inline;`
`function ObjToUInt(p: TObject): UIntPtr; inline;`
`function UIntToObj(i: UIntPtr): TObject; inline;`
`procedure threadedCall(proc: TProcedureOfObject; isfinished: TNotifyEvent); overload;`
`procedure threadedCall(proc: TProcedureOfObject; isfinished: TProcedureOfObject); overload;`
`procedure threadedCall(proc: TProcedure; isfinished: TProcedureOfObject); overload;`
`function charDecodeDigit(c: char): integer; inline;`
`function charDecodeHexDigit(c: char): integer; inline;`
`function charEncodeHexDigitUp(digit: integer): char;`
`function strlmove(dest,source:pansichar;destLen,sourceLen: SizeInt):pansichar;`
`function widestrlmove(dest,source:pwidechar;destLen,sourceLen: SizeInt):pwidechar;`
`function strCopyFrom(const s: string; start:SizeInt): string; inline;`
`function strSlice(const first,last:pansichar):string; overload;`
`function strSlice(const s: string; start,last:SizeInt): string; overload;`
`procedure strMoveRef(var source: string; var dest: string; const size: SizeInt); inline;`
`function strlEqual(const p1,p2:pansichar;const l: SizeInt):boolean; overload; inline;`
`function strlEqual(const p1,p2:pansichar;const l1,l2: SizeInt):boolean; overload; inline;`
`function strliEqual(const p1,p2:pansichar;const l: SizeInt):boolean; overload;`
`function strliEqual(const p1,p2:pansichar;const l1,l2: SizeInt):boolean; overload; inline;`
`function strlsEqual(const p1,p2:pansichar;const l: SizeInt):boolean; overload; inline;`
`function strlsEqual(const p1,p2:pansichar;const l1,l2: SizeInt):boolean; overload; inline;`
`function strlsiEqual(const p1,p2:pansichar;const l: SizeInt):boolean; overload;`
`function strlsiEqual(const p1,p2:pansichar;const l1,l2: SizeInt):boolean; overload; inline;`
`function strlsequal(p: pansichar; const s: string; l: SizeInt): boolean; overload;`
`function strlnsiequal(p1,p2:pansichar;l2: SizeInt):boolean;`
`function strlnsequal(p1,p2:pansichar;l2: SizeInt):boolean;`
`function strlEqual(p:pansichar;const s:string; l: SizeInt):boolean; overload;`
`function strliEqual(p:pansichar;const s:string;l: SizeInt):boolean; overload;`
`function strlBeginsWith(const p:pansichar; l:SizeInt; const expectedStart:string):boolean;`
`function strliBeginsWith(const p:pansichar;l: SizeInt;const expectedStart:string):boolean; inline;`
`function strEqual(const s1,s2:RawByteString):boolean;`
`function striEqual(const s1,s2:RawByteString):boolean; inline;`
`function strBeginsWith(const strToBeExaminated,expectedStart:string):boolean; overload;`
`function striBeginsWith(const strToBeExaminated,expectedStart:string):boolean; overload;`
`function strBeginsWith(const p:pansichar; const expectedStart:string):boolean; overload; inline;`
`function striBeginsWith(const p:pansichar; const expectedStart:string):boolean; overload; inline;`
`function strEndsWith(const strToBeExaminated,expectedEnd:string):boolean;`
`function striEndsWith(const strToBeExaminated,expectedEnd:string):boolean;`
`function strCompareClever(const s1, s2: string): longint;`
`function striCompareClever(const s1, s2: string): longint; inline;`
`function strRpos(c:ansichar;const s:string):SizeInt;`
`function strCount(const str: string; const searched: ansichar; from: SizeInt = 1): SizeInt; overload;`
`function strCount(const str: string; const searched: TCharSet; from: SizeInt = 1): SizeInt; overload;`
`function strlsIndexOf(str,searched:pansichar; l1, l2: SizeInt): SizeInt; overload;`
`function strlsIndexOf(str:pansichar; const searched: TCharSet; length: SizeInt): SizeInt; overload;`
`function strlsiIndexOf(str,searched:pansichar; l1, l2: SizeInt): SizeInt;`
`function strIndexOf(const str,searched:string):SizeInt; overload; inline;`
`function strIndexOf(const str: string; const searched: TCharSet):SizeInt; overload; inline;`
`function striIndexOf(const str,searched:string):SizeInt; overload; inline;`
`function strIndexOf(const str,searched:string; from: SizeInt):SizeInt; overload; inline;`
`function strIndexOf(const str: string; const searched: TCharSet; from: SizeInt):SizeInt; overload; inline;`
`function striIndexOf(const str,searched:string; from: SizeInt):SizeInt; overload; inline;`
`function strlsLastIndexOf(str,searched:pansichar; l1, l2: SizeInt): SizeInt; overload;`
`function strlsLastIndexOf(str:pansichar; const searched: TCharSet; length: SizeInt): SizeInt; overload;`
`function strlsiLastIndexOf(str,searched:pansichar; l1, l2: SizeInt): SizeInt;`
`function strLastIndexOf(const str: string; const searched: string):SizeInt; overload; inline;`
`function strLastIndexOf(const str: string; const searched: string; from: SizeInt):SizeInt; overload; inline;`
`function strLastIndexOf(const str: string; const searched: TCharSet):SizeInt; overload; inline;`
`function strLastIndexOf(const str: string; const searched: TCharSet; from: SizeInt):SizeInt; overload; inline;`
`function striLastIndexOf(const str: string; const searched: string):SizeInt; overload; inline;`
`function striLastIndexOf(const str: string; const searched: string; from: SizeInt):SizeInt; overload; inline;`
`function strContains(const str,searched:string):boolean; overload; inline;`
`function strContains(const str:string; const searched: TCharSet):boolean; overload; inline;`
`function striContains(const str,searched:string):boolean; overload; inline;`
`function strContains(const str,searched:string; from: SizeInt):boolean; overload; inline;`
`function strContains(const str:string; const searched: TCharSet; from: SizeInt):boolean; overload; inline;`
`function striContains(const str,searched:string; from: SizeInt):boolean; overload; inline;`
`procedure strlTrimLeft(var p: pansichar; var l: SizeInt; const trimCharacters: TCharSet = [#0..' ']);`
`procedure strlTrimRight(var p: pansichar; var l: SizeInt; const trimCharacters: TCharSet = [#0..' ']);`
`procedure strlTrim(var p: pansichar; var l: SizeInt; const trimCharacters: TCharSet = [#0..' ']);`
`function strTrimCommon(const s: string; const trimCharacters: TCharSet; const trimProc: TStrTrimProcedure): string;`
`function strTrimLeft(const s:string; const trimCharacters: TCharSet = [#0..' ']):string; inline;`
`function strTrimRight(const s:string; const trimCharacters: TCharSet = [#0..' ']):string; inline;`
`function strTrim(const s: string; const trimCharacters: TCharSet = [#0..' ']):string; inline;`
`function strTrimAndNormalize(const s: string; const trimCharacters: TCharSet = [#0..' ']):string;`
`function strNormalizeLineEndings(const s: string): string;`
`function strNormalizeLineEndingsUTF8(const s: RawByteString): UTF8String;`
`function strPrependIfMissing(const s: string; const expectedStart: string): string;`
`function strAppendIfMissing(const s: string; const expectedEnd: string): string;`
`function strSplitGet(const separator: string; var remainingPart: string):string; overload;`
`procedure strSplit(out firstPart: string; const separator: string; var remainingPart: string); overload;`
`procedure strSplit(out splitted: TStringArray;s: string; sep:string=',';includeEmpty:boolean=true); overload;`
`function strSplit(s:string;sep:string=',';includeEmpty:boolean=true):TStringArray; overload;`
`function strWrapSplit(const Line: string; MaxCol: SizeInt = 80; const BreakChars: TCharSet = [' ', #9]): TStringArray;`
`function strWrap(Line: string; MaxCol: SizeInt = 80; const BreakChars: TCharSet = [' ', #9]): string;`
`function strReverse(s: string): string;`
`function strSplitGetUntilBracketClosing(var text: string; const openBracket, closingBracket: string; updateText: boolean): string;`
`function strSplitGetBetweenBrackets(var text: string; const openBracket, closingBracket: string; updateText: boolean): string;`
`function strBeforeLast(const s: string; const sep: TCharSet): string; overload;`
`function strAfterLast(const s: string; const sep: TCharSet): string; overload;`
`function strJoin(const sl: TStrings; const sep: string = ', '; limit: integer=0; const limitStr: string='...'): string; overload;`
`function strJoin(const sl: TStringArray; const sep: string = ', '; limit: SizeInt=0; const limitStr: string='...'): string; overload;`
`function strJoin(strings: PString; stringsLength: SizeInt; const sep: string = ', '): string; overload;`
`function StrToBoolDef(const S: string;const Def:Boolean): Boolean;`
`function strRemoveFileURLPrefix(const filename: string): string;`
`function strLoadFromFile(filename:string):string;`
`procedure strSaveToFile(filename: string;str:string);`
`function strLoadFromFileUTF8(filename:RawByteString): string;`
`procedure strSaveToFileUTF8(filename: RawByteString; str: String);`
`function strFromSIze(size: int64):string;`
`function strLengthUtf8(const str: RawByteString; out invalid: SizeInt): SizeInt;`
`function strLengthUtf8(const str: RawByteString): SizeInt;`
`function strConvertToUtf8(str: RawByteString; from: TSystemCodePage): UTF8String;`
`function strConvertFromUtf8(str: RawByteString; toe: TSystemCodePage): RawByteString;`
`function strConvert(const str: RawByteString; from, toCP: TSystemCodePage): RawByteString;`
`function strChangeEncoding(const str: RawByteString; from, toe: TSystemCodePage): RawByteString; inline; deprecated 'Use strConvert';`
`function strDecodeUTF16Character(var source: PUnicodeChar): integer;`
`procedure utf16EncodeSurrogatePair(codepoint: integer; out surrogate1, surrogate2: word);`
`procedure strUnicode2AnsiMoveProc(source:punicodechar;var dest:RawByteString;cp : TSystemCodePage;len:SizeInt);`
`procedure strAnsi2UnicodeMoveProc(source:pchar;cp : TSystemCodePage;var dest:unicodestring;len:SizeInt);`
`procedure registerFallbackUnicodeConversion; deprecated 'Codepage aware extension requires fpc >=3';`
`function strEncodingFromName(str:string):TSystemCodePage;`
`function strEncodingName(e: TSystemCodePage): string;`
`function strActualEncoding(const str: RawByteString): TSystemCodePage; inline;`
`function strActualEncoding(e: TSystemCodePage): TSystemCodePage; inline;`
`function StringCodePage(const str: RawByteString): TSystemCodePage;`
`procedure SetCodePage(var s: RawByteString; CodePage: TSystemCodePage; Convert: Boolean=True);`
`function strGetUnicodeCharacter(const character: integer; encoding: TSystemCodePage = CP_UTF8): RawByteString;`
`function strGetUnicodeCharacterUTFLength(const character: integer): integer;`
`procedure strGetUnicodeCharacterUTF(const character: integer; buffer: pansichar);`
`function strDecodeUTF8Character(const str: RawByteString; var curpos: SizeInt): integer; overload; deprecated 'Use (pchar,pchar) overload or strIterator.';`
`function strDecodeUTF8Character(var source: PChar; var remainingLength: SizeInt): integer; overload; deprecated 'Use (pchar,pchar) overload.';`
`function strDecodeUTF8Character(var currentpos: pchar; afterlast: PChar): integer; overload;`
`function strEncodingFromBOMRemove(var str:RawByteString):TSystemCodePage;`
`function strUpperCaseSpecialUTF8(codePoint: integer; out converted: ShortStringForCaseConversion): boolean;`
`function strLowerCaseSpecialUTF8(codePoint: integer; out converted: ShortStringForCaseConversion): boolean;`
`function strDecimalToUIntTry(pstart, pend: pchar; out unsignedResult: UInt64): boolean;`
`function strDecimalToUIntTry(pstart, pend: pchar; out unsignedResult: UInt32): boolean;`
`function strHexToUIntTry(pstart, pend: pchar; out unsignedResult: UInt64): boolean;`
`function strHexToUIntTry(pstart, pend: pchar; out unsignedResult: UInt32): boolean;`
`function strDecodeHTMLEntities(p:pansichar;l:SizeInt;encoding:TSystemCodePage; flags: TDecodeHTMLEntitiesFlags = []):RawByteString; overload;`
`function strDecodeHTMLEntities(s:string;encoding:TSystemCodePage; flags: TDecodeHTMLEntitiesFlags = []):RawByteString; overload;`
`function strEscape(s:string; const toEscape: TCharSet; escapeChar: ansichar = '\'): string;`
`function strEscapeToHex(s:string; const toEscape: TCharSet; escape: string = '\x'): string;`
`function strUnescapeHex(s:string; escape: string = '\x'): string;`
`function strEscapeRegex(const s:string): string;`
`function strDecodeHex(s:string):string; deprecated;`
`function strEncodeHex(s:string; const code: string = '0123456789ABCDEF'):string; deprecated;`
`function strFromPchar(p:pansichar;l:SizeInt):string;`
`function strFromPtr(p: pointer): string;`
`function strFromInt(i: int64; displayLength: longint): string;`
`function strDup(rep: string; const count: SizeInt): string;`
`function strIsAbsoluteURI(const s: string): boolean;`
`function strResolveURI(rel, base: string): string;`
`function fileNameExpand(const rel: string): string;`
`function fileNameExpandToURI(const rel: string): string;`
`function fileMoveReplace(const oldname,newname: string): boolean;`
`procedure fileSaveSafe(filename: string; callback: TFileSaveSafe; data: pointer);`
`function strSimilarity(const s, t: string): SizeInt;`
`function strIterator(const s: RawByteString): TStrIterator;`
`operator =(const cav: TPCharView; const s: string): boolean;`
`operator <>(const cav: TPCharView; const s: string): boolean;`
`operator =(const s: string; const cav: TPCharView): boolean;`
`operator <>(const s: string; const cav: TPCharView): boolean;`
`function intLog10(i:longint):longint; overload;`
`function intLog(n,b: longint): longint; overload;`
`procedure intFactor(const n,p: longint; out e, r:longint);`
`function gcd(a,b: integer): integer; overload;`
`function gcd(a,b: cardinal): cardinal; overload;`
`function gcd(a,b: int64): int64; overload;`
`function lcm(a,b: int64): int64;`
`function coprime(a,b:cardinal): boolean;`
`function factorial(i:longint):float;`
`function binomial(n,k: longint): float;`
`function binomialExpectation(n:longint;p:float):float;`
`function binomialVariance(n:longint;p:float):float;`
`function binomialDeviation(n:longint;p:float):float;`
`function binomialProbability(n:longint;p:float;k:longint):float;`
`function binomialProbabilityGE(n:longint;p:float;k:longint):float;`
`function binomialProbabilityLE(n:longint;p:float;k:longint):float;`
`function binomialProbabilityDeviationOf(n:longint;p:float;dif:float):float;`
`function binomialProbabilityApprox(n:longint;p:float;k:longint):float;`
`function binomialZScore(n:longint;p:float;k:longint):float;`
`procedure intSieveEulerPhi(const n: cardinal; var totient: TLongwordArray);`
`procedure intSieveDivisorCount(n: integer; var divcount: TLongintArray);`
`function dateWeekOfYear(const date:TDateTime):word; overload;`
`function dateWeekOfYear(year, month, day: integer):word; overload;`
`function dateIsLeapYear(const year: integer): boolean; inline;`
`function dateTimeEncode(const y,m,d,h,n,s:integer; nanoseconds: integer = 0): TDateTime;`
`function dateTimeParsePartsTry(const input,mask:string; outYear, outMonth, outDay: PInteger; outHour, outMinutes, outSeconds: PInteger; outSecondFraction: PInteger = nil; outtimezone: PInteger = nil; options: TDateTimeParsingFlags = []): TDateTimeParsingResult;`
`procedure dateTimeParseParts(const input,mask:string; outYear, outMonth, outDay: PInteger; outHour, outMinutes, outSeconds: PInteger; outSecondFraction: PInteger = nil; outtimezone: PInteger = nil);`
`function dateTimeParse(const input,mask:string; outtimezone: PInteger = nil): TDateTime;`
`function dateTimeFormat(const mask: string; y, m,d, h, n, s: Integer; nanoseconds: integer = 0; timezone: integer = high(integer)): string; overload;`
`function dateTimeFormat(const mask: string; const dateTime: TDateTime): string; overload;`
`procedure timeParseParts(const input,mask:string; outHour, outMinutes, outSeconds: PInteger; outSecondFraction: PInteger = nil; outtimezone: PInteger = nil);`
`function timeParse(const input,mask:string): TTime;`
`function timeFormat(const mask: string; h, n, s: Integer): string; overload;`
`function timeFormatNEW(const mask: string; h, n, s: Integer; nanoseconds: integer; timezone: integer = high(integer)): string; overload;`
`procedure dateParseParts(const input,mask:string; outYear, outMonth, outDay: PInteger; outtimezone: PInteger = nil);`
`function dateParse(const input,mask:string): longint;`
`function dateFormat(const mask: string; const y, m, d: integer): string;`
`function dateFormatNew(const mask: string; const y, m, d: integer; timezone: integer): string;`
`function dateFormatOld(const mask: string; const y, m, d: integer; const timezone: TDateTime): string; deprecated 'use dateFormatNew';`
`function dateEncodeTry(year, month, day: integer; out dt: TDateTime): boolean;`
`function dateEncode(year, month, day: integer): TDateTime;`
`procedure dateDecode(date: TDateTime; year, month, day: PInteger);`
`procedure stableSort(a,b: pointer; sizei: SizeInt; compareFunction: TPointerCompareFunction = nil; compareFunctionData: TObject=nil); overload;`
`function stableSort(intArray: TLongintArray; compareFunction: TPointerCompareFunction = nil; compareFunctionData: TObject=nil): TLongintArray; overload;`
`function stableSort(strArray: TStringArray; compareFunction: TPointerCompareFunction = nil; compareFunctionData: TObject=nil): TStringArray; overload;`
`function stableSort(intArray: TSizeintArray; compareFunction: TPointerCompareFunction = nil; compareFunctionData: TObject=nil): TSizeintArray; overload;`
`function binarySearch(a,b: pointer; size: SizeInt; compareFunction: TBinarySearchFunction = nil; compareFunctionData: TObject=nil; choosen: TBinarySearchChoosen = bsAny; condition: TBinarySearchAcceptedConditions = [bsEqual]): pointer;`
`function eUTF8: TSystemCodePage; inline; deprecated;`
`function eWindows1252: TSystemCodePage; inline; deprecated;`
`function arrayAdd(var a: TStringArray; const e: string):SizeInt; overload;`
`function arrayAdd(var a: TStringArray; const a2: array of string):SizeInt; overload;`
`procedure arrayPrepend(var a: TStringArray; const e: string); overload;`
`function arrayDelete(var a: TStringArray; const i: SizeInt):string; overload;`
`function arrayDeleteUnordered(var a: TStringArray; const i: SizeInt):string; overload;`
`procedure arrayReserveFast(var a: TStringArray; const len: SizeInt; const reserveLength: SizeInt); overload;`
`function arrayAddFast(var a: TStringArray; var len: SizeInt; const e: string): SizeInt; overload;`
`procedure arrayPrependFast(var a: TStringArray; var len: SizeInt; const e: string); overload;`
`function arrayDeleteFast(var a: TStringArray; var len: SizeInt; const i: SizeInt):string; overload;`
`function arrayDeleteUnorderedFast(var a: TStringArray; var len: SizeInt; const i: SizeInt):string; overload;`
`procedure arrayInsert(var a: TStringArray; i: SizeInt; const e: string); overload;`
`procedure arrayInsertFast(var a: TStringArray; var len: SizeInt; i: SizeInt; const e: string); overload;`
`function arrayIndexOf(const a: array of string; const e: string; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
`function arrayIndexOfSmallest(const a: array of string; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
`function arrayIndexOfLargest(const a: array of string; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
`function arrayContains(const a: array of string; const e: string; slice1: SizeInt = -1; slice2: SizeInt = -1): boolean; overload;`
`procedure arrayInvert(a: TStringArray; slice1: SizeInt = -1;slice2: SizeInt = -1); overload;`
`function arraySlice(a: array of string; slice1: SizeInt = -1;slice2: SizeInt = -1): TStringArray; overload;`
`function arrayGet(a: array of string; const i: SizeInt): string; overload;`
`function arrayLast(a: array of string): string; overload;`
`function arrayLast(a: array of string; const default: string): string; overload;`
`function arrayCompare(a, b: array of string; slice1a: SizeInt = -1; slice1b: SizeInt = -1; slice2a: SizeInt = -1; slice2b: SizeInt = -1): longint; overload;`
`function arrayEqual(a, b: array of string; slice1a: SizeInt = -1; slice1b: SizeInt = -1; slice2a: SizeInt = -1; slice2b: SizeInt = -1): boolean; overload;`
`function arrayAdd(var a: TLongintArray; const e: longint):SizeInt; overload;`
`function arrayAdd(var a: TLongintArray; const a2: array of longint):SizeInt; overload;`
`procedure arrayPrepend(var a: TLongintArray; const e: longint); overload;`
`function arrayDelete(var a: TLongintArray; const i: SizeInt):longint; overload;`
`function arrayDeleteUnordered(var a: TLongintArray; const i: SizeInt):longint; overload;`
`procedure arrayReserveFast(var a: TLongintArray; const len: SizeInt; const reserveLength: SizeInt); overload;`
`function arrayAddFast(var a: TLongintArray; var len: SizeInt; const e: longint): SizeInt; overload;`
`procedure arrayPrependFast(var a: TLongintArray; var len: SizeInt; const e: longint); overload;`
`function arrayDeleteFast(var a: TLongintArray; var len: SizeInt; const i: SizeInt):longint; overload;`
`function arrayDeleteUnorderedFast(var a: TLongintArray; var len: SizeInt; const i: SizeInt):longint; overload;`
`procedure arrayInsert(var a: TLongintArray; i: SizeInt; const e: longint); overload;`
`procedure arrayInsertFast(var a: TLongintArray; var len: SizeInt; i: SizeInt; const e: longint); overload;`
`function arrayIndexOf(const a: array of longint; const e: longint; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
`function arrayIndexOfSmallest(const a: array of longint; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
`function arrayIndexOfLargest(const a: array of longint; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
`function arrayContains(const a: array of longint; const e: longint; slice1: SizeInt = -1; slice2: SizeInt = -1): boolean; overload;`
`procedure arrayInvert(a: TLongintArray; slice1: SizeInt = -1;slice2: SizeInt = -1); overload;`
`function arraySlice(a: array of longint; slice1: SizeInt = -1;slice2: SizeInt = -1): TLongintArray; overload;`
`function arrayGet(a: array of longint; const i: SizeInt): longint; overload;`
`function arrayLast(a: array of longint): longint; overload;`
`function arrayLast(a: array of longint; const default: longint): longint; overload;`
`function arrayCompare(a, b: array of longint; slice1a: SizeInt = -1; slice1b: SizeInt = -1; slice2a: SizeInt = -1; slice2b: SizeInt = -1): longint; overload;`
`function arrayEqual(a, b: array of longint; slice1a: SizeInt = -1; slice1b: SizeInt = -1; slice2a: SizeInt = -1; slice2b: SizeInt = -1): boolean; overload;`
`function arrayAdd(var a: TLongwordArray; const e: longword):SizeInt; overload;`
`function arrayAdd(var a: TLongwordArray; const a2: array of longword):SizeInt; overload;`
`procedure arrayPrepend(var a: TLongwordArray; const e: longword); overload;`
`function arrayDelete(var a: TLongwordArray; const i: SizeInt):longword; overload;`
`function arrayDeleteUnordered(var a: TLongwordArray; const i: SizeInt):longword; overload;`
`procedure arrayReserveFast(var a: TLongwordArray; const len: SizeInt; const reserveLength: SizeInt); overload;`
`function arrayAddFast(var a: TLongwordArray; var len: SizeInt; const e: longword): SizeInt; overload;`
`procedure arrayPrependFast(var a: TLongwordArray; var len: SizeInt; const e: longword); overload;`
`function arrayDeleteFast(var a: TLongwordArray; var len: SizeInt; const i: SizeInt):longword; overload;`
`function arrayDeleteUnorderedFast(var a: TLongwordArray; var len: SizeInt; const i: SizeInt):longword; overload;`
`procedure arrayInsert(var a: TLongwordArray; i: SizeInt; const e: longword); overload;`
`procedure arrayInsertFast(var a: TLongwordArray; var len: SizeInt; i: SizeInt; const e: longword); overload;`
`function arrayIndexOf(const a: array of longword; const e: longword; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
`function arrayIndexOfSmallest(const a: array of longword; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
`function arrayIndexOfLargest(const a: array of longword; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
`function arrayContains(const a: array of longword; const e: longword; slice1: SizeInt = -1; slice2: SizeInt = -1): boolean; overload;`
`procedure arrayInvert(a: TLongwordArray; slice1: SizeInt = -1;slice2: SizeInt = -1); overload;`
`function arraySlice(a: array of longword; slice1: SizeInt = -1;slice2: SizeInt = -1): TLongwordArray; overload;`
`function arrayGet(a: array of longword; const i: SizeInt): longword; overload;`
`function arrayLast(a: array of longword): longword; overload;`
`function arrayLast(a: array of longword; const default: longword): longword; overload;`
`function arrayCompare(a, b: array of longword; slice1a: SizeInt = -1; slice1b: SizeInt = -1; slice2a: SizeInt = -1; slice2b: SizeInt = -1): longint; overload;`
`function arrayEqual(a, b: array of longword; slice1a: SizeInt = -1; slice1b: SizeInt = -1; slice2a: SizeInt = -1; slice2b: SizeInt = -1): boolean; overload;`
`function arrayAdd(var a: TInt64Array; const e: int64):SizeInt; overload;`
`function arrayAdd(var a: TInt64Array; const a2: array of int64):SizeInt; overload;`
`procedure arrayPrepend(var a: TInt64Array; const e: int64); overload;`
`function arrayDelete(var a: TInt64Array; const i: SizeInt):int64; overload;`
`function arrayDeleteUnordered(var a: TInt64Array; const i: SizeInt):int64; overload;`
`procedure arrayReserveFast(var a: TInt64Array; const len: SizeInt; const reserveLength: SizeInt); overload;`
`function arrayAddFast(var a: TInt64Array; var len: SizeInt; const e: int64): SizeInt; overload;`
`procedure arrayPrependFast(var a: TInt64Array; var len: SizeInt; const e: int64); overload;`
`function arrayDeleteFast(var a: TInt64Array; var len: SizeInt; const i: SizeInt):int64; overload;`
`function arrayDeleteUnorderedFast(var a: TInt64Array; var len: SizeInt; const i: SizeInt):int64; overload;`
`procedure arrayInsert(var a: TInt64Array; i: SizeInt; const e: int64); overload;`
`procedure arrayInsertFast(var a: TInt64Array; var len: SizeInt; i: SizeInt; const e: int64); overload;`
`function arrayIndexOf(const a: array of int64; const e: int64; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
`function arrayIndexOfSmallest(const a: array of int64; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
`function arrayIndexOfLargest(const a: array of int64; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
`function arrayContains(const a: array of int64; const e: int64; slice1: SizeInt = -1; slice2: SizeInt = -1): boolean; overload;`
`procedure arrayInvert(a: TInt64Array; slice1: SizeInt = -1;slice2: SizeInt = -1); overload;`
`function arraySlice(a: array of int64; slice1: SizeInt = -1;slice2: SizeInt = -1): TInt64Array; overload;`
`function arrayGet(a: array of int64; const i: SizeInt): int64; overload;`
`function arrayLast(a: array of int64): int64; overload;`
`function arrayLast(a: array of int64; const default: int64): int64; overload;`
`function arrayCompare(a, b: array of int64; slice1a: SizeInt = -1; slice1b: SizeInt = -1; slice2a: SizeInt = -1; slice2b: SizeInt = -1): longint; overload;`
`function arrayEqual(a, b: array of int64; slice1a: SizeInt = -1; slice1b: SizeInt = -1; slice2a: SizeInt = -1; slice2b: SizeInt = -1): boolean; overload;`
`function arrayAdd(var a: TFloatArray; const e: float):SizeInt; overload;`
`function arrayAdd(var a: TFloatArray; const a2: array of float):SizeInt; overload;`
`procedure arrayPrepend(var a: TFloatArray; const e: float); overload;`
`function arrayDelete(var a: TFloatArray; const i: SizeInt):float; overload;`
`function arrayDeleteUnordered(var a: TFloatArray; const i: SizeInt):float; overload;`
`procedure arrayReserveFast(var a: TFloatArray; const len: SizeInt; const reserveLength: SizeInt); overload;`
`function arrayAddFast(var a: TFloatArray; var len: SizeInt; const e: float): SizeInt; overload;`
`procedure arrayPrependFast(var a: TFloatArray; var len: SizeInt; const e: float); overload;`
`function arrayDeleteFast(var a: TFloatArray; var len: SizeInt; const i: SizeInt):float; overload;`
`function arrayDeleteUnorderedFast(var a: TFloatArray; var len: SizeInt; const i: SizeInt):float; overload;`
`procedure arrayInsert(var a: TFloatArray; i: SizeInt; const e: float); overload;`
`procedure arrayInsertFast(var a: TFloatArray; var len: SizeInt; i: SizeInt; const e: float); overload;`
`function arrayIndexOf(const a: array of float; const e: float; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
`function arrayIndexOfSmallest(const a: array of float; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
`function arrayIndexOfLargest(const a: array of float; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
`function arrayContains(const a: array of float; const e: float; slice1: SizeInt = -1; slice2: SizeInt = -1): boolean; overload;`
`procedure arrayInvert(a: TFloatArray; slice1: SizeInt = -1;slice2: SizeInt = -1); overload;`
`function arraySlice(a: array of float; slice1: SizeInt = -1;slice2: SizeInt = -1): TFloatArray; overload;`
`function arrayGet(a: array of float; const i: SizeInt): float; overload;`
`function arrayLast(a: array of float): float; overload;`
`function arrayLast(a: array of float; const default: float): float; overload;`
`function arrayCompare(a, b: array of float; slice1a: SizeInt = -1; slice1b: SizeInt = -1; slice2a: SizeInt = -1; slice2b: SizeInt = -1): longint; overload;`
`function arrayEqual(a, b: array of float; slice1a: SizeInt = -1; slice1b: SizeInt = -1; slice2a: SizeInt = -1; slice2b: SizeInt = -1): boolean; overload;`
`function unequal(const a, b: integer): boolean; overload;`
`function unequal(const a, b, c: integer): boolean; overload;`
`function unequal(const a: array of integer): boolean; overload;`
`function unequal(const a, b: cardinal): boolean; overload;`
`function unequal(const a, b, c: cardinal): boolean; overload;`
`function unequal(const a: array of cardinal): boolean; overload;`
`function unequal(const a, b: string): boolean; overload;`
`function unequal(const a, b, c: string): boolean; overload;`
`function unequal(const a: array of string): boolean; overload;`
`function unequal(const a, b: int64): boolean; overload;`
`function unequal(const a, b, c: int64): boolean; overload;`
`function unequal(const a: array of int64): boolean; overload;`
`function strBetween(const s, from, till: string): string;`
`function strBefore(const s, sep: string): string; overload;`
`function strAfter(const s, sep: string): string; overload;`
`function strBeforeLast(const s, sep: string): string; overload;`
`function strAfterLast(const s, sep: string): string; overload;`
`function striBetween(const s, from, till: string): string;`
`function striBefore(const s, sep: string): string; overload;`
`function striAfter(const s, sep: string): string; overload;`
`function striBeforeLast(const s, sep: string): string; overload;`
`function striAfterLast(const s, sep: string): string; overload;`
`function intSqrt(const i: longint): longint; overload;`
`function intSqrt(const i: int64): int64; overload;`
`function modPow(i, e, m: longint): longint; overload;`
`function intBound(min, i, max: longint): longint; overload;`
`function modPow(i, e, m: int64): int64; overload;`
`function intBound(min, i, max: int64): int64; overload;`
`function arrayBinarySearch(a: TStringArray; const value: string; choosen: TBinarySearchChoosen = bsAny; condition: TBinarySearchAcceptedConditions = [bsEqual]): SizeInt; overload;`
`function arrayBinarySearch(a: TLongintArray; const value: longint; choosen: TBinarySearchChoosen = bsAny; condition: TBinarySearchAcceptedConditions = [bsEqual]): SizeInt; overload;`
`function arrayBinarySearch(a: TLongwordArray; const value: longword; choosen: TBinarySearchChoosen = bsAny; condition: TBinarySearchAcceptedConditions = [bsEqual]): SizeInt; overload;`
`function arrayBinarySearch(a: TInt64Array; const value: int64; choosen: TBinarySearchChoosen = bsAny; condition: TBinarySearchAcceptedConditions = [bsEqual]): SizeInt; overload;`
`function arrayBinarySearch(a: TFloatArray; const value: float; choosen: TBinarySearchChoosen = bsAny; condition: TBinarySearchAcceptedConditions = [bsEqual]): SizeInt; overload;`
`procedure ignore(const intentionallyUnusedParameter: string); overload; inline;`
`procedure ignore(const intentionallyUnusedParameter: boolean); overload; inline;`
`procedure ignore(const intentionallyUnusedParameter: integer); overload; inline;`
`procedure ignore(const intentionallyUnusedParameter: Int64); overload; inline;`
`procedure ignore(const intentionallyUnusedParameter: TObject); overload; inline;`
`procedure ignore(const intentionallyUnusedParameter: pointer); overload; inline;`

### Types

`RawByteString = AnsiString;`
`TSystemCodePage = Word;`
`TStringArray=array of string;`
`TLongintArray =array of longint;`
`TSizeintArray =array of SizeInt;`
`TLongwordArray =array of longword;`
`TInt64Array =array of int64;`
`TFloatArray = array of float;`
`TCharSet = set of ansichar;`
`TProcedureOfObject = procedure () of object;`
`TStreamLikeWriteNativeInt = procedure(const Buffer; Count: NativeInt) of object;`
`TStrTrimProcedure = procedure (var p: pansichar; var l: SizeInt; const trimCharacters: TCharSet);`
`ShortStringForCaseConversion = String[7];`
`TDecodeHTMLEntitiesFlag = (...);`
`TDecodeHTMLEntitiesFlags = set of TDecodeHTMLEntitiesFlag;`
`TFileSaveSafe = procedure (stream: TStream; data: pointer);`
`TStringViewArray = TStringView.TStringViewArray;`
`TPointerArrayList = specialize TCopyingPtrArrayList<pointer>;`
`TObjectArrayList = specialize TCopyingPtrArrayList<TObject>;`
`TSizeIntArrayList = specialize TCopyingPtrArrayList<SizeInt>;`
`TStringArrayList = specialize TCopyingPtrArrayList<String>;`
`TDateTimeParsingFlag = (...);`
`TDateTimeParsingFlags = set of TDateTimeParsingFlag;`
`TDateTimeParsingResult = (...);`
`TPointerCompareFunction = function (data: TObject; a, b: pointer): longint;`
`TBinarySearchChoosen = (...);`
`TBinarySearchAcceptedCondition = (...);`
`TBinarySearchAcceptedConditions = set of TBinarySearchAcceptedCondition;`
`TBinarySearchFunction = function (data: TObject; a: pointer): longint;`

### Constants

`PACKAGE_VERSION = '0.9.0.repo';`
`CP_ACP = 0;`
`CP_OEMCP = 1;`
`CP_UTF16 = 1200;`
`CP_UTF16BE = 1201;`
`CP_UTF8 = 65001;`
`CP_NONE = $FFFF;`
`CP_ASCII = 20127;`
`CP_UTF32 = 12000;`
`CP_UTF32BE = 12001;`
`CP_WINDOWS1252 = 1252;`
`CP_LATIN1 = 28591;`
`powersOf10: array[0..9] of longint = (1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000);`
`DateMonthDaysCumSum: array[false..true,0..12] of integer = ((00, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365), (00, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366));`
`WHITE_SPACE=[#9,#10,#13,' '];`

## Description

### Functions and Procedures

`function procedureToMethod(proc: TProcedure): TMethod;`

`function makeMethod(code, data: pointer): TMethod; inline;`

`function PtrToUInt(p: pointer): UIntPtr; inline;`

`function UIntToPtr(i: UIntPtr): pointer; inline;`

`function ObjToUInt(p: TObject): UIntPtr; inline;`

`function UIntToObj(i: UIntPtr): TObject; inline;`

`procedure threadedCall(proc: TProcedureOfObject; isfinished: TNotifyEvent); overload;`
Calls proc in an new thread

`procedure threadedCall(proc: TProcedureOfObject; isfinished: TProcedureOfObject); overload;`
Calls proc in an new thread

`procedure threadedCall(proc: TProcedure; isfinished: TProcedureOfObject); overload;`
Calls proc in an new thread

`function charDecodeDigit(c: char): integer; inline;`

`function charDecodeHexDigit(c: char): integer; inline;`

`function charEncodeHexDigitUp(digit: integer): char;`

`function strlmove(dest,source:pansichar;destLen,sourceLen: SizeInt):pansichar;`
Copies min(sourceLen, destLen) characters from source to dest and returns dest.

`function widestrlmove(dest,source:pwidechar;destLen,sourceLen: SizeInt):pwidechar;`
Copies min(sourceLen, destLen) characters from source to dest and returns dest.

`function strCopyFrom(const s: string; start:SizeInt): string; inline;`
Returns the substring of s containing all characters after start (including s[start]).

`function strSlice(const first,last:pansichar):string; overload;`
Returns a string with all characters between first and last (including first, last).

`function strSlice(const s: string; start,last:SizeInt): string; overload;`
Returns a string with all characters between start and last (including start, last).

`procedure strMoveRef(var source: string; var dest: string; const size: SizeInt); inline;`
Like move: moves count strings from source memory to dest memory. Keeps the reference count intact. Size is count of strings * sizeof(string)!

`function strlEqual(const p1,p2:pansichar;const l: SizeInt):boolean; overload; inline;`
Tests if the strings are case-sensitively equal (same length and same characters) (null-terminated, stops comparison when meeting #0 ).

`function strlEqual(const p1,p2:pansichar;const l1,l2: SizeInt):boolean; overload; inline;`
Tests if the strings are case-sensitively equal (same length and same characters) (null-terminated, stops comparison when meeting #0 ).

`function strliEqual(const p1,p2:pansichar;const l: SizeInt):boolean; overload;`
Tests if the strings are case-insensitively equal (same length and same characters) (null-terminated, stops comparison when meeting #0 ).

`function strliEqual(const p1,p2:pansichar;const l1,l2: SizeInt):boolean; overload; inline;`
Tests if the strings are case-insensitively equal (same length and same characters) (null-terminated, stops comparison when meeting #0 ).

`function strlsEqual(const p1,p2:pansichar;const l: SizeInt):boolean; overload; inline;`
Tests if the strings are case-sensitively equal (same length and same characters) (strict-length, can continue comparison after #0).

`function strlsEqual(const p1,p2:pansichar;const l1,l2: SizeInt):boolean; overload; inline;`
Tests if the strings are case-sensitively equal (same length and same characters) (strict-length, can continue comparison after #0).

`function strlsiEqual(const p1,p2:pansichar;const l: SizeInt):boolean; overload;`
Tests if the strings are case-insensitively equal (same length and same characters) (strict-length, can continue comparison after #0).

`function strlsiEqual(const p1,p2:pansichar;const l1,l2: SizeInt):boolean; overload; inline;`
Tests if the strings are case-insensitively equal (same length and same characters) (strict-length, can continue comparison after #0).

`function strlsequal(p: pansichar; const s: string; l: SizeInt): boolean; overload;`

`function strlnsiequal(p1,p2:pansichar;l2: SizeInt):boolean;`
equal comparison, case insensitive, stopping at #0-bytes in p1, ignoring #0-bytes in p2.

`function strlnsequal(p1,p2:pansichar;l2: SizeInt):boolean;`
equal comparison, case sensitive, stopping at #0-bytes in p1, ignoring #0-bytes in p2.

`function strlEqual(p:pansichar;const s:string; l: SizeInt):boolean; overload;`
Tests if the strings are case-sensitively equal (same length and same characters).

`function strliEqual(p:pansichar;const s:string;l: SizeInt):boolean; overload;`
Tests if the strings are case-insensitively equal (same length and same characters).

`function strlBeginsWith(const p:pansichar; l:SizeInt; const expectedStart:string):boolean;`
Test if p begins with expectedStart (case-sensitive).

`function strliBeginsWith(const p:pansichar;l: SizeInt;const expectedStart:string):boolean; inline;`
Test if p begins with expectedStart (case-insensitive).

`function strEqual(const s1,s2:RawByteString):boolean;`
Tests if the strings are case-insensitively equal (same length and same characters).

`function striEqual(const s1,s2:RawByteString):boolean; inline;`
Tests if the strings are case-insensitively equal (same length and same characters).

`function strBeginsWith(const strToBeExaminated,expectedStart:string):boolean; overload;`
Tests if `strToBeExaminated` starts with `expectedStart`.

`function striBeginsWith(const strToBeExaminated,expectedStart:string):boolean; overload;`
Tests if `strToBeExaminated` starts with `expectedStart`.

`function strBeginsWith(const p:pansichar; const expectedStart:string):boolean; overload; inline;`
Tests if `p` starts with `expectedStart` (p is null-terminated).

`function striBeginsWith(const p:pansichar; const expectedStart:string):boolean; overload; inline;`
Tests if `p` starts with `expectedStart` (p is null-terminated).

`function strEndsWith(const strToBeExaminated,expectedEnd:string):boolean;`
Tests if `strToBeExaminated` ends with `expectedEnd`.

`function striEndsWith(const strToBeExaminated,expectedEnd:string):boolean;`
Tests if `strToBeExaminated` ends with `expectedEnd`.

`function strCompareClever(const s1, s2: string): longint;`
Case sensitive, clever comparison, that basically splits the string into lexicographical and numerical parts and compares them accordingly.

`function striCompareClever(const s1, s2: string): longint; inline;`
Case insensitive, clever comparison, that basically splits the string into lexicographical and numerical parts and compares them accordingly.

`function strRpos(c:ansichar;const s:string):SizeInt;`
Searchs the last index of c in s.

`function strCount(const str: string; const searched: ansichar; from: SizeInt = 1): SizeInt; overload;`
Counts all occurrences of searched in searchIn (case sensitive).

`function strCount(const str: string; const searched: TCharSet; from: SizeInt = 1): SizeInt; overload;`
Counts all occurrences of searched in searchIn (case sensitive).

`function strlsIndexOf(str,searched:pansichar; l1, l2: SizeInt): SizeInt; overload;`
Searchs `searched` in `str` case-sensitively (Attention: opposite parameter order of Pos) (strict length, this function can find #0-bytes).

`function strlsIndexOf(str:pansichar; const searched: TCharSet; length: SizeInt): SizeInt; overload;`
Searchs `searched` in `str` case-sensitively (Attention: opposite parameter order of Pos) (strict length, this function can find #0-bytes).

`function strlsiIndexOf(str,searched:pansichar; l1, l2: SizeInt): SizeInt;`
Searchs `searched` in `str` case-insensitively (Attention: opposite parameter order of Pos) (strict length, this function can find #0-bytes).

`function strIndexOf(const str,searched:string):SizeInt; overload; inline;`
Searchs `searched` in `str` case-sensitively (Attention: opposite parameter order of Pos).

`function strIndexOf(const str: string; const searched: TCharSet):SizeInt; overload; inline;`
Searchs `searched` in `str` case-sensitively (Attention: opposite parameter order of Pos).

`function striIndexOf(const str,searched:string):SizeInt; overload; inline;`
Searchs `searched` in `str` case-insensitively (Attention: opposite parameter order of Pos).

`function strIndexOf(const str,searched:string; from: SizeInt):SizeInt; overload; inline;`
Searchs `searched` in `str` case-sensitively (Attention: opposite parameter order of Pos).

`function strIndexOf(const str: string; const searched: TCharSet; from: SizeInt):SizeInt; overload; inline;`
Searchs `searched` in `str` case-sensitively (Attention: opposite parameter order of Pos).

`function striIndexOf(const str,searched:string; from: SizeInt):SizeInt; overload; inline;`
Searchs `searched` in `str` case-insensitively (Attention: opposite parameter order of Pos).

`function strlsLastIndexOf(str,searched:pansichar; l1, l2: SizeInt): SizeInt; overload;`
Searchs `searched` in `str`, case-sensitive, returns -1 on no occurrence (Attention: opposite parameter order of Pos) (strict length, this function can find #0-bytes).

`function strlsLastIndexOf(str:pansichar; const searched: TCharSet; length: SizeInt): SizeInt; overload;`
Searchs `searched` in `str`, case-sensitive, returns -1 on no occurrence (Attention: opposite parameter order of Pos) (strict length, this function can find #0-bytes).

`function strlsiLastIndexOf(str,searched:pansichar; l1, l2: SizeInt): SizeInt;`
Searchs `searched` in `str`, case-insensitive, returns -1 on no occurrence (Attention: opposite parameter order of Pos) (strict length, this function can find #0-bytes).

`function strLastIndexOf(const str: string; const searched: string):SizeInt; overload; inline;`
Searchs the last occurrence of `searched` in `str`, case-sensitive, returns 0 on no occurrence (Attention: opposite parameter order of Pos).

`function strLastIndexOf(const str: string; const searched: string; from: SizeInt):SizeInt; overload; inline;`
Searchs the last occurrence of `searched` in `str`, case-sensitive, returns 0 on no occurrence (Attention: opposite parameter order of Pos).

`function strLastIndexOf(const str: string; const searched: TCharSet):SizeInt; overload; inline;`
Searchs the last occurrence of `searched` in `str`, case-sensitive, returns 0 on no occurrence (Attention: opposite parameter order of Pos).

`function strLastIndexOf(const str: string; const searched: TCharSet; from: SizeInt):SizeInt; overload; inline;`
Searchs the last occurrence of `searched` in `str`, case-sensitive, returns 0 on no occurrence (Attention: opposite parameter order of Pos).

`function striLastIndexOf(const str: string; const searched: string):SizeInt; overload; inline;`
Searchs the last occurrence of `searched` in `str`, case-insensitive, returns 0 on no occurrence (Attention: opposite parameter order of Pos).

`function striLastIndexOf(const str: string; const searched: string; from: SizeInt):SizeInt; overload; inline;`
Searchs the last occurrence of `searched` in `str`, case-insensitive, returns 0 on no occurrence (Attention: opposite parameter order of Pos).

`function strContains(const str,searched:string):boolean; overload; inline;`
Tests if `searched` exists in `str` case-sensitive (Attention: opposite parameter order of Pos).

`function strContains(const str:string; const searched: TCharSet):boolean; overload; inline;`
Tests if `searched` exists in `str` case-sensitive (Attention: opposite parameter order of Pos).

`function striContains(const str,searched:string):boolean; overload; inline;`
Tests if `searched` exists in `str` case-insensitive (Attention: opposite parameter order of Pos).

`function strContains(const str,searched:string; from: SizeInt):boolean; overload; inline;`
Tests if `searched` exists in `str` case-sensitive (Attention: opposite parameter order of Pos).

`function strContains(const str:string; const searched: TCharSet; from: SizeInt):boolean; overload; inline;`
Tests if `searched` exists in `str` case-sensitive (Attention: opposite parameter order of Pos).

`function striContains(const str,searched:string; from: SizeInt):boolean; overload; inline;`
Tests if `searched` exists in `str` case-insensitive (Attention: opposite parameter order of Pos).

`procedure strlTrimLeft(var p: pansichar; var l: SizeInt; const trimCharacters: TCharSet = [#0..' ']);`
Removes all occurrences of trimCharacter from the left/right side of the string. It will move the pointer and change length, not modifying the memory pointed to.

`procedure strlTrimRight(var p: pansichar; var l: SizeInt; const trimCharacters: TCharSet = [#0..' ']);`
Removes all occurrences of trimCharacter from the left/right side of the string. It will move the pointer and change length, not modifying the memory pointed to.

`procedure strlTrim(var p: pansichar; var l: SizeInt; const trimCharacters: TCharSet = [#0..' ']);`
Removes all occurrences of trimCharacter from the left/right side of the string. It will move the pointer and change length, not modifying the memory pointed to.

`function strTrimCommon(const s: string; const trimCharacters: TCharSet; const trimProc: TStrTrimProcedure): string;`

`function strTrimLeft(const s:string; const trimCharacters: TCharSet = [#0..' ']):string; inline;`
Removes all occurrences of trimCharacter from the left side of the string.

`function strTrimRight(const s:string; const trimCharacters: TCharSet = [#0..' ']):string; inline;`
Removes all occurrences of trimCharacter from the right side of the string.

`function strTrim(const s: string; const trimCharacters: TCharSet = [#0..' ']):string; inline;`
Removes all occurrences of trimCharacter from the left and right side of the string.

`function strTrimAndNormalize(const s: string; const trimCharacters: TCharSet = [#0..' ']):string;`
Replaces any sequence of trimCharacter with a single space, and removes leading/trailing spaces.

`function strNormalizeLineEndings(const s: string): string;`
Replaces all #13#10 or #13 by #10.

`function strNormalizeLineEndingsUTF8(const s: RawByteString): UTF8String;`
Replaces all #$D#$A, #$D #$85, #$85, #$2028, or #13 by #10. Experimental, behaviour might change in future.

`function strPrependIfMissing(const s: string; const expectedStart: string): string;`
Prepends expectedStart, if s does not starts with expectedStart.

`function strAppendIfMissing(const s: string; const expectedEnd: string): string;`
Appends expectedEnd, if s does not end with expectedEnd.

`function strSplitGet(const separator: string; var remainingPart: string):string; overload;`
Splits the string remainingPart into two parts at the first position of separator, the first part is returned as function result, the second one is again assign to remainingPart. (If remainingPart does not contain separator, it returns remainingPart and sets remainingPart := '')

`procedure strSplit(out firstPart: string; const separator: string; var remainingPart: string); overload;`
Splits the string remainingPart into two parts at the first position of separator, the first is assign to firstPart, the second one is again assign to remainingPart.

`procedure strSplit(out splitted: TStringArray;s: string; sep:string=',';includeEmpty:boolean=true); overload;`
Splits the string s into the array splitted at every occurrence of sep.

`function strSplit(s:string;sep:string=',';includeEmpty:boolean=true):TStringArray; overload;`
Splits the string s into the array splitted at every occurrence of sep.

`function strWrapSplit(const Line: string; MaxCol: SizeInt = 80; const BreakChars: TCharSet = [' ', #9]): TStringArray;`
Word wraps a string to a maximum column length.

`function strWrap(Line: string; MaxCol: SizeInt = 80; const BreakChars: TCharSet = [' ', #9]): string;`
Word wraps a string to a maximum column length.

`function strReverse(s: string): string;`
reverses a string. Assumes the encoding is utf-8.

`function strSplitGetUntilBracketClosing(var text: string; const openBracket, closingBracket: string; updateText: boolean): string;`
Given a string like openBracket .. openBracket ... closingBracket closingBracket closingBracket closingBracket , this will return everything between the string start and the second last closingBracket (it assumes one bracket is already opened, so 3 open vs. 4 closing => second last). If updateText is true, it will replace text with everything after that closingBracket. (always excluding the bracket itself)

`function strSplitGetBetweenBrackets(var text: string; const openBracket, closingBracket: string; updateText: boolean): string;`

`function strBeforeLast(const s: string; const sep: TCharSet): string; overload;`
If the string s has the form 'STARTsep...', it returns 'START'. E.g. for /foo/bar, it returns /foo with AllowDirectorySeparators do.

`function strAfterLast(const s: string; const sep: TCharSet): string; overload;`
If the string s has the form '...sepEND', it returns 'END'. E.g. for /foo/bar, it returns bar with AllowDirectorySeparators.

`function strJoin(const sl: TStrings; const sep: string = ', '; limit: integer=0; const limitStr: string='...'): string; overload;`
Joins all string list items to a single string separated by `sep`. If `limit` is set, the string is limited to `abs(limit)` items. if limit is positive, limitStr is appended; if limitStr is negative, limitStr is inserted in the middle.

`function strJoin(const sl: TStringArray; const sep: string = ', '; limit: SizeInt=0; const limitStr: string='...'): string; overload;`
Joins all string list items to a single string separated by `sep`.

`function strJoin(strings: PString; stringsLength: SizeInt; const sep: string = ', '): string; overload;`

`function StrToBoolDef(const S: string;const Def:Boolean): Boolean;`
Converts a str to a bool (for fpc versions before 2.2)

`function strRemoveFileURLPrefix(const filename: string): string;`
Removes a file:// prefix from filename if it is there,

`function strLoadFromFile(filename:string):string;`
Loads a file as string. The filename is directly passed to the fpc rtl and uses the system encoding. ###### See also strLoadFromFileUTF8 Loads a file as string.

`procedure strSaveToFile(filename: string;str:string);`
Saves a string as file. The filename is directly passed to the fpc rtl and uses the system encoding. ###### See also strSaveToFileUTF8 Saves a string as file.

`function strLoadFromFileUTF8(filename:RawByteString): string;`
Loads a file as string. The filename should be encoded in utf-8. ###### See also strLoadFromFile Loads a file as string.

`procedure strSaveToFileUTF8(filename: RawByteString; str: String);`
Saves a string as file. The filename should be encoded in utf-8. ###### See also strSaveToFile Saves a string as file.

`function strFromSIze(size: int64):string;`
converts a size (measured in bytes) to a string (e.g. 1025 -> 1 KiB).

`function strLengthUtf8(const str: RawByteString; out invalid: SizeInt): SizeInt;`
length of an utf8 string. ###### Parameters invalid, number of invalid encodings

`function strLengthUtf8(const str: RawByteString): SizeInt;`
length of an utf8 string.

`function strConvertToUtf8(str: RawByteString; from: TSystemCodePage): UTF8String;`
Convert a string to UTF-8 from encoding from `from`.

`function strConvertFromUtf8(str: RawByteString; toe: TSystemCodePage): RawByteString;`
Convert a string from UTF-8 to the encoding `from`.

`function strConvert(const str: RawByteString; from, toCP: TSystemCodePage): RawByteString;`
Converts a string from one encoding to another. It primarily converts between latin-1 and utf-8 without needing a widestring manager. It performs the conversion directly without converting to UTF-16, which should be much faster than fpc's default conversions. But there are no low-level optimizations. For other encodings it falls back to the moveprocs (which allows to store utf-16/32 in RawByteString) and SetCodePage.

`function strChangeEncoding(const str: RawByteString; from, toe: TSystemCodePage): RawByteString; inline; deprecated 'Use strConvert';`
Warning: this symbol is deprecated: Use strConvert deprecated

`function strDecodeUTF16Character(var source: PUnicodeChar): integer;`
Decodes an UTF-16 and moves to the next character.

`procedure utf16EncodeSurrogatePair(codepoint: integer; out surrogate1, surrogate2: word);`
Encodes an UTF-16 surrogate pair.

`procedure strUnicode2AnsiMoveProc(source:punicodechar;var dest:RawByteString;cp : TSystemCodePage;len:SizeInt);`
converts utf16 to other unicode pages and latin1. The signature matches the function of fpc's widestringmanager, so this function replaces cwstring. len is in chars.

`procedure strAnsi2UnicodeMoveProc(source:pchar;cp : TSystemCodePage;var dest:unicodestring;len:SizeInt);`
converts unicode pages and latin1 to utf16. The signature matches the function of fpc's widestringmanager, so this function replaces cwstring. len is in bytes

`procedure registerFallbackUnicodeConversion; deprecated 'Codepage aware extension requires fpc >=3';`
Warning: this symbol is deprecated: Codepage aware extension requires fpc >=3

`function strEncodingFromName(str:string):TSystemCodePage;`
Gets the encoding from an encoding name (e.g. from http-equiv)

`function strEncodingName(e: TSystemCodePage): string;`

`function strActualEncoding(const str: RawByteString): TSystemCodePage; inline;`

`function strActualEncoding(e: TSystemCodePage): TSystemCodePage; inline;`

`function StringCodePage(const str: RawByteString): TSystemCodePage;`

`procedure SetCodePage(var s: RawByteString; CodePage: TSystemCodePage; Convert: Boolean=True);`
no-op function, so not every `SetCodePage` has to be wrapped in ifdefs when using FPC 2.x.

`function strGetUnicodeCharacter(const character: integer; encoding: TSystemCodePage = CP_UTF8): RawByteString;`
Gets unicode character `character` in a certain encoding.

`function strGetUnicodeCharacterUTFLength(const character: integer): integer;`

`procedure strGetUnicodeCharacterUTF(const character: integer; buffer: pansichar);`

`function strDecodeUTF8Character(const str: RawByteString; var curpos: SizeInt): integer; overload; deprecated 'Use (pchar,pchar) overload or strIterator.';`
Warning: this symbol is deprecated: Use (pchar,pchar) overload or strIterator. Returns the unicode code point of the utf-8 character starting at `str[curpos]` and increments `curpos` to the next utf-8 character. Returns a negative value if the character is invalid.

`function strDecodeUTF8Character(var source: PChar; var remainingLength: SizeInt): integer; overload; deprecated 'Use (pchar,pchar) overload.';`
Warning: this symbol is deprecated: Use (pchar,pchar) overload. Returns the unicode code point of the utf-8 character starting at `source` and decrements `remainingLength` to the next utf-8 character. Returns a negative value if the character is invalid.

`function strDecodeUTF8Character(var currentpos: pchar; afterlast: PChar): integer; overload;`
Returns the unicode code point of the utf-8 character starting at `source`. Returns a negative value if the character is invalid.

`function strEncodingFromBOMRemove(var str:RawByteString):TSystemCodePage;`
Gets the encoding from an unicode bom and removes it

`function strUpperCaseSpecialUTF8(codePoint: integer; out converted: ShortStringForCaseConversion): boolean;`
This function converts codePoint to the corresponding uppercase codepoint according to the unconditional cases of SpecialCasing.txt of Unicode 8. It cannot be used to convert a character to uppercase, as SpecialCasing.txt is not a map from normal characters to their uppercase variants. It is a collection of special characters that do not have an ordinary uppercase variant and are converted to something else. (e.g. ß -> SS) The function signature is preliminary and likely to change.

`function strLowerCaseSpecialUTF8(codePoint: integer; out converted: ShortStringForCaseConversion): boolean;`
This function converts codePoint to the corresponding lowercase codepoint according to the unconditional cases of SpecialCasing.txt of Unicode 8. It cannot be used to convert a character to lowercase, as SpecialCasing.txt is not a map from normal characters to their lowercase variants. It is a collection of special characters that do not have an ordinary lowercase variant and are converted to something else. The function signature is preliminary and likely to change.

`function strDecimalToUIntTry(pstart, pend: pchar; out unsignedResult: UInt64): boolean;`
Converts a pchar buffer to an unsigned integer. Returns true iff the pchar matches [0-9]+ and does not overflow

`function strDecimalToUIntTry(pstart, pend: pchar; out unsignedResult: UInt32): boolean;`
Converts a pchar buffer to an unsigned integer. Returns true iff the pchar matches [0-9]+ and does not overflow

`function strHexToUIntTry(pstart, pend: pchar; out unsignedResult: UInt64): boolean;`
Converts a pchar buffer to an unsigned integer. Returns true iff the pchar matches [0-9A-Fa-f]+ and does not overflow

`function strHexToUIntTry(pstart, pend: pchar; out unsignedResult: UInt32): boolean;`
Converts a pchar buffer to an unsigned integer. Returns true iff the pchar matches [0-9A-Fa-f]+ and does not overflow

`function strDecodeHTMLEntities(p:pansichar;l:SizeInt;encoding:TSystemCodePage; flags: TDecodeHTMLEntitiesFlags = []):RawByteString; overload;`
This decodes all html entities to the given encoding. If strict is not set it will ignore wrong entities (so e.g. X&Y will remain X&Y and you can call the function even if it contains rogue &).

`function strDecodeHTMLEntities(s:string;encoding:TSystemCodePage; flags: TDecodeHTMLEntitiesFlags = []):RawByteString; overload;`
This decodes all html entities to the given encoding. If strict is not set it will ignore wrong entities (so e.g. X&Y will remain X&Y and you can call the function even if it contains rogue &).

`function strEscape(s:string; const toEscape: TCharSet; escapeChar: ansichar = '\'): string;`
Replace all occurrences of x \in toEscape with escapeChar + x.

`function strEscapeToHex(s:string; const toEscape: TCharSet; escape: string = '\x'): string;`
Replace all occurrences of x \in toEscape with escape + hex(ord(x)).

`function strUnescapeHex(s:string; escape: string = '\x'): string;`
Replace all occurrences of escape + XX with chr(XX).

`function strEscapeRegex(const s:string): string;`
Returns a regex matching s.

`function strDecodeHex(s:string):string; deprecated;`
Warning: this symbol is deprecated. Decodes a binary hex string like 202020 where every pair of hex digits corresponds to one char (deprecated, use strUnescapeHex).

`function strEncodeHex(s:string; const code: string = '0123456789ABCDEF'):string; deprecated;`
Warning: this symbol is deprecated. Encodes to a binary hex string like 202020 where every pair of hex digits corresponds to one char (deprecated, use strEscapeToHex).

`function strFromPchar(p:pansichar;l:SizeInt):string;`
Returns the first l bytes of p (copies them so O(n)).

`function strFromPtr(p: pointer): string;`
Creates a string to display the value of a pointer (e.g. 0xDEADBEEF).

`function strFromInt(i: int64; displayLength: longint): string;`
Creates a string to display an integer. The result will have at least displayLength digits (digits, not characters, so -1 with length 2, will become -02).

`function strDup(rep: string; const count: SizeInt): string;`
Creates count copies of rep

`function strIsAbsoluteURI(const s: string): boolean;`
Checks if s is an absolute uri (i.e. has a [a-zA-Z][a-zA-Z0-9+-.]:// prefix).

`function strResolveURI(rel, base: string): string;`
Returns a absolute uri for a uri relative to the uri base. E.g. `strResolveURI`('foo/bar', 'http://example.org/abc/def') returns 'http://example.org/abc/foo/bar' Or. `strResolveURI`('foo/bar', 'http://example.org/abc/def/') returns 'http://example.org/abc/def/foo/bar' base may be relative itself (e.g. `strResolveURI`('foo/bar', 'test/') becomes 'test/foo/bar')

`function fileNameExpand(const rel: string): string;`
Expands a path to an absolute path if it not already is one.

`function fileNameExpandToURI(const rel: string): string;`
Expands a path to an absolute path starting with file://.

`function fileMoveReplace(const oldname,newname: string): boolean;`
Moves oldname to newname, replacing newname if it exists.

`procedure fileSaveSafe(filename: string; callback: TFileSaveSafe; data: pointer);`
Overrides the file filename with the data written to the stream in the callback function. If the file already exists, the data is first written to a temporary file to prevent the file from being overriden partially.

`function strSimilarity(const s, t: string): SizeInt;`
Levenshtein distance between s and t. (i.e. the minimal count of characters to change/add/remove to convert s to t). O(n**2) time, O(n) space.

`function strIterator(const s: RawByteString): TStrIterator;`
Str iterator. Preliminary. Interface might change at any time.

`operator =(const cav: TPCharView; const s: string): boolean;`

`operator <>(const cav: TPCharView; const s: string): boolean;`

`operator =(const s: string; const cav: TPCharView): boolean;`

`operator <>(const s: string; const cav: TPCharView): boolean;`

`function intLog10(i:longint):longint; overload;`
log 10 rounded down (= number of digits in base 10 - 1)

`function intLog(n,b: longint): longint; overload;`
log_b n rounded down (= number of digits of n in base b - 1)

`procedure intFactor(const n,p: longint; out e, r:longint);`
Given a number n, this procedure calculates the maximal integer e, so that n = pˆe * r

`function gcd(a,b: integer): integer; overload;`
Calculates the greatest common denominator

`function gcd(a,b: cardinal): cardinal; overload;`
Calculates the greatest common denominator

`function gcd(a,b: int64): int64; overload;`
Calculates the greatest common denominator

`function lcm(a,b: int64): int64;`
Calculates the least common multiple (just a*b div gcd(a,b), so it can easily overflow)

`function coprime(a,b:cardinal): boolean;`
Checks if two numbers are `coprime`

`function factorial(i:longint):float;`
Calculates i!

`function binomial(n,k: longint): float;`
Calculates n|k = n!/k!(n-k)!

`function binomialExpectation(n:longint;p:float):float;`
expectated value of a binomial distribution

`function binomialVariance(n:longint;p:float):float;`
variance of a binomial distribution

`function binomialDeviation(n:longint;p:float):float;`
deviation(=sqrt(variance)) of a binomial distribution

`function binomialProbability(n:longint;p:float;k:longint):float;`
probability: P(X = k) where X is binomial distributed with n possible values (exact value calculated with binomial coefficients, ) ###### See also binomialProbabilityApprox expectated value of a binomial distribution (approximates the value with either Poisson or Moivre and Laplace, depending on the variance of the distribution) )

`function binomialProbabilityGE(n:longint;p:float;k:longint):float;`
probability: P(X >= k) where X is binomial distributed with n possible values

`function binomialProbabilityLE(n:longint;p:float;k:longint):float;`
probability: P(X <= k) where X is binomial distributed with n possible values

`function binomialProbabilityDeviationOf(n:longint;p:float;dif:float):float;`
probability: P(X >= mu + d or X <= mu - d) where X is binomial distributed with n possible values

`function binomialProbabilityApprox(n:longint;p:float;k:longint):float;`
expectated value of a binomial distribution (approximates the value with either Poisson or Moivre and Laplace, depending on the variance of the distribution) ) ###### See also binomialProbability probability: P(X = k) where X is binomial distributed with n possible values (exact value calculated with binomial coefficients, )

`function binomialZScore(n:longint;p:float;k:longint):float;`
Z-Score of the value k in a distribution with n outcomes

`procedure intSieveEulerPhi(const n: cardinal; var totient: TLongwordArray);`
This calculates the euler phi function totient[i] := phi(i) = |{1 <= j <= i | gcd(i,j) = 0}| for all i <= n. It uses a sieve approach and is quite fast (10ˆ7 in 3s) You can also use it to calculate all primes (i is prime iff phi(i) = i - 1)

`procedure intSieveDivisorCount(n: integer; var divcount: TLongintArray);`
This calculates the number of divisors: divcount[i] := |{1 <= j <= i | i mod j = 0}| for all i <= n. Speed: 10ˆ7 in 5s

`function dateWeekOfYear(const date:TDateTime):word; overload;`
Week of year

`function dateWeekOfYear(year, month, day: integer):word; overload;`

`function dateIsLeapYear(const year: integer): boolean; inline;`
###### Returns if year is a leap year (supports negative years, i think)

`function dateTimeEncode(const y,m,d,h,n,s:integer; nanoseconds: integer = 0): TDateTime;`
Encodes a date time

`function dateTimeParsePartsTry(const input,mask:string; outYear, outMonth, outDay: PInteger; outHour, outMinutes, outSeconds: PInteger; outSecondFraction: PInteger = nil; outtimezone: PInteger = nil; options: TDateTimeParsingFlags = []): TDateTimeParsingResult;`
Reads a date time string given a certain mask (mask is case-sensitive) The function uses the same mask types as FormatDate: s or ss for a second n or nn for a minute h or hh for a hour d or dd for a numerical day m or mm for a numerical month, mmm for a short month name, mmmm for a long month name am/pm or a/p match am/pm or a/p yy, yyyy or [yy]yy for the year. (if the year is < 90, it will become 20yy, else if it is < 100, it will become 19yy, unless you use uppercase Y instead of y) YY, YYYY or [YY]YY for the year, too. z, zz, zzz, zzzz for microseconds (e.g. use [.zzzzzz] for optional ms with exactly 6 digit precision, use [.z[z[z[z[z[z]]]]]] for optional µs with up to 6 digit precision) Z for the ISO time zone (written as regular expressions, it matches 'Z | [+-]hh(:?mm)?'. Z is the only format ansichar (except mmm) matching several characters) The letter formats d/y/h/n/s matches one or two digits, the dd/mm/yy formats require exactly two. yyyy requires exactly 4 digits, and [yy]yy works with 2 or 4 (there is also [y]yyy for 3 to 4). The year always matches an optional - (e.g. yyyy also matches -0012, but not -012) Generally [x] marks the part x as optional (it tries all possible combinations, so you shouldn't have more than 10 optional parts) x+ will match any additional amount of x. (e.g. yy -> 2 digit year, yy+ -> at least 2 digit year, yyyy -> 4 digit year, [yy]yy -> 2 or 4 digit year) (mmm+ for short or long dates) "something" can be used to match the input verbatim whitespace is matched against whitespace (i.e. [ #9#10#13]+ matches [ #9#10#13]+) The function works if the string is latin-1 or utf-8, and it also supports German month names If a part is not found, it returns high(integer) there There are old and new functions, because the signature has changed from double to int. Do not use the OLD functions unless you are porting existing code. ###### Returns If input could be matched with mask. It does not check, if the returned values are valid (e.g. month = 13 is allowed, in case you have to match durations)

`procedure dateTimeParseParts(const input,mask:string; outYear, outMonth, outDay: PInteger; outHour, outMinutes, outSeconds: PInteger; outSecondFraction: PInteger = nil; outtimezone: PInteger = nil);`
Reads date/time parts from a input matching a given mask ###### See also dateTimeParsePartsTry Reads a date time string given a certain mask (mask is case-sensitive) The function uses the same mask types as FormatDate: s or ss for a second n or nn for a minute h or hh for a hour d or dd for a numerical day m or mm for a numerical month, mmm for a short month name, mmmm for a long month name am/pm or a/p match am/pm or a/p yy, yyyy or [yy]yy for the year. (if the year is < 90, it will become 20yy, else if it is < 100, it will become 19yy, unless you use uppercase Y instead of y) YY, YYYY or [YY]YY for the year, too. z, zz, zzz, zzzz for microseconds (e.g. use [.zzzzzz] for optional ms with exactly 6 digit precision, use [.z[z[z[z[z[z]]]]]] for optional µs with up to 6 digit precision) Z for the ISO time zone (written as regular expressions, it matches 'Z | [+-]hh(:?mm)?'. Z is the only format ansichar (except mmm) matching several characters) The letter formats d/y/h/n/s matches one or two digits, the dd/mm/yy formats require exactly two. yyyy requires exactly 4 digits, and [yy]yy works with 2 or 4 (there is also [y]yyy for 3 to 4).

`function dateTimeParse(const input,mask:string; outtimezone: PInteger = nil): TDateTime;`
Reads date/time from a input matching a given mask ###### See also dateTimeParsePartsTry Reads a date time string given a certain mask (mask is case-sensitive) The function uses the same mask types as FormatDate: s or ss for a second n or nn for a minute h or hh for a hour d or dd for a numerical day m or mm for a numerical month, mmm for a short month name, mmmm for a long month name am/pm or a/p match am/pm or a/p yy, yyyy or [yy]yy for the year. (if the year is < 90, it will become 20yy, else if it is < 100, it will become 19yy, unless you use uppercase Y instead of y) YY, YYYY or [YY]YY for the year, too. z, zz, zzz, zzzz for microseconds (e.g. use [.zzzzzz] for optional ms with exactly 6 digit precision, use [.z[z[z[z[z[z]]]]]] for optional µs with up to 6 digit precision) Z for the ISO time zone (written as regular expressions, it matches 'Z | [+-]hh(:?mm)?'. Z is the only format ansichar (except mmm) matching several characters) The letter formats d/y/h/n/s matches one or two digits, the dd/mm/yy formats require exactly two. yyyy requires exactly 4 digits, and [yy]yy works with 2 or 4 (there is also [y]yyy for 3 to 4).

`function dateTimeFormat(const mask: string; y, m,d, h, n, s: Integer; nanoseconds: integer = 0; timezone: integer = high(integer)): string; overload;`
Converts a dateTime to a string corresponding to the given mask (same mask as dateTimeParsePartsTry)

`function dateTimeFormat(const mask: string; const dateTime: TDateTime): string; overload;`
Converts a dateTime to a string corresponding to the given mask (same mask as dateTimeParsePartsTry)

`procedure timeParseParts(const input,mask:string; outHour, outMinutes, outSeconds: PInteger; outSecondFraction: PInteger = nil; outtimezone: PInteger = nil);`
Reads a time string given a certain mask ###### See also dateTimeParsePartsTry Reads a date time string given a certain mask (mask is case-sensitive) The function uses the same mask types as FormatDate: s or ss for a second n or nn for a minute h or hh for a hour d or dd for a numerical day m or mm for a numerical month, mmm for a short month name, mmmm for a long month name am/pm or a/p match am/pm or a/p yy, yyyy or [yy]yy for the year. (if the year is < 90, it will become 20yy, else if it is < 100, it will become 19yy, unless you use uppercase Y instead of y) YY, YYYY or [YY]YY for the year, too. z, zz, zzz, zzzz for microseconds (e.g. use [.zzzzzz] for optional ms with exactly 6 digit precision, use [.z[z[z[z[z[z]]]]]] for optional µs with up to 6 digit precision) Z for the ISO time zone (written as regular expressions, it matches 'Z | [+-]hh(:?mm)?'. Z is the only format ansichar (except mmm) matching several characters) The letter formats d/y/h/n/s matches one or two digits, the dd/mm/yy formats require exactly two. yyyy requires exactly 4 digits, and [yy]yy works with 2 or 4 (there is also [y]yyy for 3 to 4).

`function timeParse(const input,mask:string): TTime;`
Reads a time string given a certain mask . This function checks, if the time is valid. ###### See also dateTimeParsePartsTry Reads a date time string given a certain mask (mask is case-sensitive) The function uses the same mask types as FormatDate: s or ss for a second n or nn for a minute h or hh for a hour d or dd for a numerical day m or mm for a numerical month, mmm for a short month name, mmmm for a long month name am/pm or a/p match am/pm or a/p yy, yyyy or [yy]yy for the year. (if the year is < 90, it will become 20yy, else if it is < 100, it will become 19yy, unless you use uppercase Y instead of y) YY, YYYY or [YY]YY for the year, too. z, zz, zzz, zzzz for microseconds (e.g. use [.zzzzzz] for optional ms with exactly 6 digit precision, use [.z[z[z[z[z[z]]]]]] for optional µs with up to 6 digit precision) Z for the ISO time zone (written as regular expressions, it matches 'Z | [+-]hh(:?mm)?'. Z is the only format ansichar (except mmm) matching several characters) The letter formats d/y/h/n/s matches one or two digits, the dd/mm/yy formats require exactly two. yyyy requires exactly 4 digits, and [yy]yy works with 2 or 4 (there is also [y]yyy for 3 to 4).

`function timeFormat(const mask: string; h, n, s: Integer): string; overload;`
Converts a time to a string corresponding to the given mask (same mask as dateTimeParsePartsTry)

`function timeFormatNEW(const mask: string; h, n, s: Integer; nanoseconds: integer; timezone: integer = high(integer)): string; overload;`

`procedure dateParseParts(const input,mask:string; outYear, outMonth, outDay: PInteger; outtimezone: PInteger = nil);`
Reads a date string given a certain mask ###### See also dateTimeParsePartsTry Reads a date time string given a certain mask (mask is case-sensitive) The function uses the same mask types as FormatDate: s or ss for a second n or nn for a minute h or hh for a hour d or dd for a numerical day m or mm for a numerical month, mmm for a short month name, mmmm for a long month name am/pm or a/p match am/pm or a/p yy, yyyy or [yy]yy for the year. (if the year is < 90, it will become 20yy, else if it is < 100, it will become 19yy, unless you use uppercase Y instead of y) YY, YYYY or [YY]YY for the year, too. z, zz, zzz, zzzz for microseconds (e.g. use [.zzzzzz] for optional ms with exactly 6 digit precision, use [.z[z[z[z[z[z]]]]]] for optional µs with up to 6 digit precision) Z for the ISO time zone (written as regular expressions, it matches 'Z | [+-]hh(:?mm)?'. Z is the only format ansichar (except mmm) matching several characters) The letter formats d/y/h/n/s matches one or two digits, the dd/mm/yy formats require exactly two. yyyy requires exactly 4 digits, and [yy]yy works with 2 or 4 (there is also [y]yyy for 3 to 4).

`function dateParse(const input,mask:string): longint;`
Reads a date string given a certain mask . This function checks whether the date is valid. ###### See also dateTimeParsePartsTry Reads a date time string given a certain mask (mask is case-sensitive) The function uses the same mask types as FormatDate: s or ss for a second n or nn for a minute h or hh for a hour d or dd for a numerical day m or mm for a numerical month, mmm for a short month name, mmmm for a long month name am/pm or a/p match am/pm or a/p yy, yyyy or [yy]yy for the year. (if the year is < 90, it will become 20yy, else if it is < 100, it will become 19yy, unless you use uppercase Y instead of y) YY, YYYY or [YY]YY for the year, too. z, zz, zzz, zzzz for microseconds (e.g. use [.zzzzzz] for optional ms with exactly 6 digit precision, use [.z[z[z[z[z[z]]]]]] for optional µs with up to 6 digit precision) Z for the ISO time zone (written as regular expressions, it matches 'Z | [+-]hh(:?mm)?'. Z is the only format ansichar (except mmm) matching several characters) The letter formats d/y/h/n/s matches one or two digits, the dd/mm/yy formats require exactly two. yyyy requires exactly 4 digits, and [yy]yy works with 2 or 4 (there is also [y]yyy for 3 to 4).

`function dateFormat(const mask: string; const y, m, d: integer): string;`
Converts a date to a string corresponding to the given mask (same mask as dateTimeParsePartsTry)

`function dateFormatNew(const mask: string; const y, m, d: integer; timezone: integer): string;`
Converts a date to a string corresponding to the given mask (same mask as dateTimeParsePartsTry)

`function dateFormatOld(const mask: string; const y, m, d: integer; const timezone: TDateTime): string; deprecated 'use dateFormatNew';`
Warning: this symbol is deprecated: use dateFormatNew

`function dateEncodeTry(year, month, day: integer; out dt: TDateTime): boolean;`
Encodes a date as datetime (supports negative years)

`function dateEncode(year, month, day: integer): TDateTime;`
Encodes a date as datetime (supports negative years)

`procedure dateDecode(date: TDateTime; year, month, day: PInteger);`
Encodes a date as datetime (supports negative years)

`procedure stableSort(a,b: pointer; sizei: SizeInt; compareFunction: TPointerCompareFunction = nil; compareFunctionData: TObject=nil); overload;`
General stable sort function, . Only the > 0 and <= 0 return values are discerned. (i.e. you can safely use a comparison function that e.g. only returns +7 and 0) Currently it uses a quick sort with a temporary buffer (quick sort taken from FPC. It used to use merge+insert sort, but that was too slow). ###### Parameters a the first element in the array to sort, b the last (inclusive!), size the size of every elementm compareFunction a function which compares two pointer to elements of the array, if it is nil, it will compare the raw bytes (which will correspond to an ascending sorting of positive integers)

`function stableSort(intArray: TLongintArray; compareFunction: TPointerCompareFunction = nil; compareFunctionData: TObject=nil): TLongintArray; overload;`
general stable sort functions for arrays (modifying the array inline and returning it)

`function stableSort(strArray: TStringArray; compareFunction: TPointerCompareFunction = nil; compareFunctionData: TObject=nil): TStringArray; overload;`

`function stableSort(intArray: TSizeintArray; compareFunction: TPointerCompareFunction = nil; compareFunctionData: TObject=nil): TSizeintArray; overload;`

`function binarySearch(a,b: pointer; size: SizeInt; compareFunction: TBinarySearchFunction = nil; compareFunctionData: TObject=nil; choosen: TBinarySearchChoosen = bsAny; condition: TBinarySearchAcceptedConditions = [bsEqual]): pointer;`
General binary search function. It can find an element or a lower/upper bound. `a` points to the first element in the (ascending, sorted) array, `b` to the last, `size` the size of each element. `compareFunction` is a TBinarySearchFunction comparing the searched element to another element. `compareFunctionData` is the data passed to the comparison function as first argument (you can think of it as searched element). `choosen` is the element that should be returned, if there are multiple matches (bsFirst, bsLast or bsAny). `condition` the comparison relation between the returned and searched element (E.g. for [bsGreater, bsEqual] the returned element satisfies `compareFunction(reference, returned) <= 0`.) returns a pointer to the found match or nil if there is none. (note that you can combine, e.g. bsGreater and bsLast, which will always return the last element, unless all are lower) Beware of the pointers. You need to be very carefully. `a` and `b` point to the first and last elements. They are not the element, they are pointers to the location of the element in the array. If a = b, the array has one element. You need to pass a < b for empty arrays. The first parameter of `compareFunction` is user defined data, so it can be anything. The second parameter is a pointer to the location of an array element. It is not the array element itself, not even on a list of pointers. The same holds for the pointer returned by the function, i.e. it is like that second parameter.

`function eUTF8: TSystemCodePage; inline; deprecated;`
Warning: this symbol is deprecated.

`function eWindows1252: TSystemCodePage; inline; deprecated;`
Warning: this symbol is deprecated.

`function arrayAdd(var a: TStringArray; const e: string):SizeInt; overload;`
Adds element `e` to array `a`. Returns i with a[i]=e.

`function arrayAdd(var a: TStringArray; const a2: array of string):SizeInt; overload;`
Adds elements from a2 `e` to array `a`. Returns the OLD length of a.

`procedure arrayPrepend(var a: TStringArray; const e: string); overload;`
Prepends `e` to `a`, i.e. inserts `e` at position 0. (Quite slow, O(n)).

`function arrayDelete(var a: TStringArray; const i: SizeInt):string; overload;`
Removes element at position i from a. Returns e=a[i].

`function arrayDeleteUnordered(var a: TStringArray; const i: SizeInt):string; overload;`
Removes element at position i from a (destroying the order of the elements). Returns e=a[i].

`procedure arrayReserveFast(var a: TStringArray; const len: SizeInt; const reserveLength: SizeInt); overload;`
Ensures that `a` has at least `reserveLength` elements.

`function arrayAddFast(var a: TStringArray; var len: SizeInt; const e: string): SizeInt; overload;`
returns i with a[i]=e.

`procedure arrayPrependFast(var a: TStringArray; var len: SizeInt; const e: string); overload;`
Prepends `e` to `a`, i.e. inserts `e` at position 0. (Quite slow, O(n))

`function arrayDeleteFast(var a: TStringArray; var len: SizeInt; const i: SizeInt):string; overload;`
Removes element at position i from a. Returns e=a[i].

`function arrayDeleteUnorderedFast(var a: TStringArray; var len: SizeInt; const i: SizeInt):string; overload;`
Removes element at position i from a (destroying the order of the elements). Returns e=a[i].

`procedure arrayInsert(var a: TStringArray; i: SizeInt; const e: string); overload;`
Inserts element e at position i in a.

`procedure arrayInsertFast(var a: TStringArray; var len: SizeInt; i: SizeInt; const e: string); overload;`
Inserts element e at position i in a.

`function arrayIndexOf(const a: array of string; const e: string; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
Finds element e in the array/slice (see above).

`function arrayIndexOfSmallest(const a: array of string; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
Finds the smallest element, in the array/slice (see above).

`function arrayIndexOfLargest(const a: array of string; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
Finds the largest element in the array/slice (see above).

`function arrayContains(const a: array of string; const e: string; slice1: SizeInt = -1; slice2: SizeInt = -1): boolean; overload;`
Tests if element e exists in the array/slice (see above).

`procedure arrayInvert(a: TStringArray; slice1: SizeInt = -1;slice2: SizeInt = -1); overload;`
Inverts the order of the elements in the array/slice (see above).

`function arraySlice(a: array of string; slice1: SizeInt = -1;slice2: SizeInt = -1): TStringArray; overload;`
Extracts a array slice.

`function arrayGet(a: array of string; const i: SizeInt): string; overload;`
Returns the i-th element of the array. If i < 0, the indices are taken from the end of the array. (which is actually the only use case)

`function arrayLast(a: array of string): string; overload;`
Returns the last element of the array, raises exception, iff the array is empty.

`function arrayLast(a: array of string; const default: string): string; overload;`
Returns the last element of the array, returns default, iff the array is empty.

`function arrayCompare(a, b: array of string; slice1a: SizeInt = -1; slice1b: SizeInt = -1; slice2a: SizeInt = -1; slice2b: SizeInt = -1): longint; overload;`
Compares two array/slices (interleaved slice parameters, so arrayEqual(a,b,3,3) compares the first 3 elements).

`function arrayEqual(a, b: array of string; slice1a: SizeInt = -1; slice1b: SizeInt = -1; slice2a: SizeInt = -1; slice2b: SizeInt = -1): boolean; overload;`
Tests if two array/slices are equal (interleaved slice parameters, so arrayEqual(a,b,3,3) tests the first 3 elements).

`function arrayAdd(var a: TLongintArray; const e: longint):SizeInt; overload;`
Adds element `e` to array `a`. Returns i with a[i]=e.

`function arrayAdd(var a: TLongintArray; const a2: array of longint):SizeInt; overload;`
Adds elements from a2 `e` to array `a`. Returns the OLD length of a.

`procedure arrayPrepend(var a: TLongintArray; const e: longint); overload;`
Prepends `e` to `a`, i.e. inserts `e` at position 0. (Quite slow, O(n))

`function arrayDelete(var a: TLongintArray; const i: SizeInt):longint; overload;`
Removes element at position i from a. Returns e=a[i].

`function arrayDeleteUnordered(var a: TLongintArray; const i: SizeInt):longint; overload;`
Removes element at position i from a (destroying the order of the elements). Returns e=a[i].

`procedure arrayReserveFast(var a: TLongintArray; const len: SizeInt; const reserveLength: SizeInt); overload;`
Ensures that `a` has at least `reserveLength` elements.

`function arrayAddFast(var a: TLongintArray; var len: SizeInt; const e: longint): SizeInt; overload;`
returns i with a[i]=e.

`procedure arrayPrependFast(var a: TLongintArray; var len: SizeInt; const e: longint); overload;`
Prepends `e` to `a`, i.e. inserts `e` at position 0. (Quite slow, O(n))

`function arrayDeleteFast(var a: TLongintArray; var len: SizeInt; const i: SizeInt):longint; overload;`
Removes element at position i from a. Returns e=a[i].

`function arrayDeleteUnorderedFast(var a: TLongintArray; var len: SizeInt; const i: SizeInt):longint; overload;`
Removes element at position i from a (destroying the order of the elements). Returns e=a[i].

`procedure arrayInsert(var a: TLongintArray; i: SizeInt; const e: longint); overload;`
Inserts element e at position i in a.

`procedure arrayInsertFast(var a: TLongintArray; var len: SizeInt; i: SizeInt; const e: longint); overload;`
Inserts element e at position i in a.

`function arrayIndexOf(const a: array of longint; const e: longint; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
Finds element e in the array/slice (see above).

`function arrayIndexOfSmallest(const a: array of longint; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
Finds the smallest element, in the array/slice (see above).

`function arrayIndexOfLargest(const a: array of longint; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
Finds the largest element in the array/slice (see above).

`function arrayContains(const a: array of longint; const e: longint; slice1: SizeInt = -1; slice2: SizeInt = -1): boolean; overload;`
Tests if element e exists in the array/slice (see above).

`procedure arrayInvert(a: TLongintArray; slice1: SizeInt = -1;slice2: SizeInt = -1); overload;`
Inverts the order of the elements in the array/slice (see above).

`function arraySlice(a: array of longint; slice1: SizeInt = -1;slice2: SizeInt = -1): TLongintArray; overload;`
Extracts a array slice.

`function arrayGet(a: array of longint; const i: SizeInt): longint; overload;`
Returns the i-th element of the array. If i < 0, the indices are taken from the end of the array. (which is actually the only use case)

`function arrayLast(a: array of longint): longint; overload;`
Returns the last element of the array, raises exception, iff the array is empty.

`function arrayLast(a: array of longint; const default: longint): longint; overload;`
Returns the last element of the array, returns default, iff the array is empty.

`function arrayCompare(a, b: array of longint; slice1a: SizeInt = -1; slice1b: SizeInt = -1; slice2a: SizeInt = -1; slice2b: SizeInt = -1): longint; overload;`
Compares two array/slices (interleaved slice parameters, so arrayEqual(a,b,3,3) compares the first 3 elements),

`function arrayEqual(a, b: array of longint; slice1a: SizeInt = -1; slice1b: SizeInt = -1; slice2a: SizeInt = -1; slice2b: SizeInt = -1): boolean; overload;`
Tests if two array/slices are equal (interleaved slice parameters, so arrayEqual(a,b,3,3) tests the first 3 elements),

`function arrayAdd(var a: TLongwordArray; const e: longword):SizeInt; overload;`
Adds element `e` to array `a`. Returns i with a[i]=e,

`function arrayAdd(var a: TLongwordArray; const a2: array of longword):SizeInt; overload;`
Adds elements from a2 `e` to array `a`. Returns the OLD length of a,

`procedure arrayPrepend(var a: TLongwordArray; const e: longword); overload;`
Prepends `e` to `a`, i.e. inserts `e` at position 0. (Quite slow, O(n))

`function arrayDelete(var a: TLongwordArray; const i: SizeInt):longword; overload;`
Removes element at position i from a, Returns e=a[i],

`function arrayDeleteUnordered(var a: TLongwordArray; const i: SizeInt):longword; overload;`
Removes element at position i from a (destroying the order of the elements), Returns e=a[i],

`procedure arrayReserveFast(var a: TLongwordArray; const len: SizeInt; const reserveLength: SizeInt); overload;`
Ensures that `a` has at least `reserveLength` elements,

`function arrayAddFast(var a: TLongwordArray; var len: SizeInt; const e: longword): SizeInt; overload;`
returns i with a[i]=e,

`procedure arrayPrependFast(var a: TLongwordArray; var len: SizeInt; const e: longword); overload;`
Prepends `e` to `a`, i.e. inserts `e` at position 0. (Quite slow, O(n))

`function arrayDeleteFast(var a: TLongwordArray; var len: SizeInt; const i: SizeInt):longword; overload;`
Removes element at position i from a, Returns e=a[i],

`function arrayDeleteUnorderedFast(var a: TLongwordArray; var len: SizeInt; const i: SizeInt):longword; overload;`
Removes element at position i from a (destroying the order of the elements), Returns e=a[i],

`procedure arrayInsert(var a: TLongwordArray; i: SizeInt; const e: longword); overload;`
Inserts element e at position i in a.

`procedure arrayInsertFast(var a: TLongwordArray; var len: SizeInt; i: SizeInt; const e: longword); overload;`
Inserts element e at position i in a.

`function arrayIndexOf(const a: array of longword; const e: longword; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
Finds element e in the array/slice (see above).

`function arrayIndexOfSmallest(const a: array of longword; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
Finds the smallest element, in the array/slice (see above).

`function arrayIndexOfLargest(const a: array of longword; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
Finds the largest element in the array/slice (see above).

`function arrayContains(const a: array of longword; const e: longword; slice1: SizeInt = -1; slice2: SizeInt = -1): boolean; overload;`
Tests if element e exists in the array/slice (see above).

`procedure arrayInvert(a: TLongwordArray; slice1: SizeInt = -1;slice2: SizeInt = -1); overload;`
Inverts the order of the elements in the array/slice (see above).

`function arraySlice(a: array of longword; slice1: SizeInt = -1;slice2: SizeInt = -1): TLongwordArray; overload;`
Extracts a array slice.

`function arrayGet(a: array of longword; const i: SizeInt): longword; overload;`
Returns the i-th element of the array. If i < 0, the indices are taken from the end of the array. (which is actually the only use case).

`function arrayLast(a: array of longword): longword; overload;`
Returns the last element of the array, raises exception, iff the array is empty.

`function arrayLast(a: array of longword; const default: longword): longword; overload;`
Returns the last element of the array, returns default, iff the array is empty.

`function arrayCompare(a, b: array of longword; slice1a: SizeInt = -1; slice1b: SizeInt = -1; slice2a: SizeInt = -1; slice2b: SizeInt = -1): longint; overload;`
Compares two array/slices (interleaved slice parameters, so arrayEqual(a,b,3,3) compares the first 3 elements).

`function arrayEqual(a, b: array of longword; slice1a: SizeInt = -1; slice1b: SizeInt = -1; slice2a: SizeInt = -1; slice2b: SizeInt = -1): boolean; overload;`
Tests if two array/slices are equal (interleaved slice parameters, so arrayEqual(a,b,3,3) tests the first 3 elements).

`function arrayAdd(var a: TInt64Array; const e: int64):SizeInt; overload;`
Adds element `e` to array `a`. Returns i with a[i]=e.

`function arrayAdd(var a: TInt64Array; const a2: array of int64):SizeInt; overload;`
Adds elements from a2 `e` to array `a`. Returns the OLD length of a.

`procedure arrayPrepend(var a: TInt64Array; const e: int64); overload;`
Prepends `e` to `a`, i.e. inserts `e` at position 0. (Quite slow, O(n))

`function arrayDelete(var a: TInt64Array; const i: SizeInt):int64; overload;`
Removes element at position i from a. Returns e=a[i].

`function arrayDeleteUnordered(var a: TInt64Array; const i: SizeInt):int64; overload;`
Removes element at position i from a (destroying the order of the elements). Returns e=a[i].

`procedure arrayReserveFast(var a: TInt64Array; const len: SizeInt; const reserveLength: SizeInt); overload;`
Ensures that `a` has at least `reserveLength` elements.

`function arrayAddFast(var a: TInt64Array; var len: SizeInt; const e: int64): SizeInt; overload;`
returns i with a[i]=e.

`procedure arrayPrependFast(var a: TInt64Array; var len: SizeInt; const e: int64); overload;`
Prepends `e` to `a`, i.e. inserts `e` at position 0. (Quite slow, O(n))

`function arrayDeleteFast(var a: TInt64Array; var len: SizeInt; const i: SizeInt):int64; overload;`
Removes element at position i from a. Returns e=a[i].

`function arrayDeleteUnorderedFast(var a: TInt64Array; var len: SizeInt; const i: SizeInt):int64; overload;`
Removes element at position i from a (destroying the order of the elements). Returns e=a[i].

`procedure arrayInsert(var a: TInt64Array; i: SizeInt; const e: int64); overload;`
Inserts element e at position i in a.

`procedure arrayInsertFast(var a: TInt64Array; var len: SizeInt; i: SizeInt; const e: int64); overload;`
Inserts element e at position i in a.

`function arrayIndexOf(const a: array of int64; const e: int64; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
Finds element e in the array/slice (see above).

`function arrayIndexOfSmallest(const a: array of int64; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
Finds the smallest element, in the array/slice (see above).

`function arrayIndexOfLargest(const a: array of int64; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
Finds the largest element in the array/slice (see above).

`function arrayContains(const a: array of int64; const e: int64; slice1: SizeInt = -1; slice2: SizeInt = -1): boolean; overload;`
Tests if element e exists in the array/slice (see above).

`procedure arrayInvert(a: TInt64Array; slice1: SizeInt = -1;slice2: SizeInt = -1); overload;`
Inverts the order of the elements in the array/slice (see above).

`function arraySlice(a: array of int64; slice1: SizeInt = -1;slice2: SizeInt = -1): TInt64Array; overload;`
Extracts a array slice.

`function arrayGet(a: array of int64; const i: SizeInt): int64; overload;`
Returns the i-th element of the array. If i < 0, the indices are taken from the end of the array. (which is actually the only use case)

`function arrayLast(a: array of int64): int64; overload;`
Returns the last element of the array, raises exception, iff the array is empty.

`function arrayLast(a: array of int64; const default: int64): int64; overload;`
Returns the last element of the array, returns default, iff the array is empty.

`function arrayCompare(a, b: array of int64; slice1a: SizeInt = -1; slice1b: SizeInt = -1; slice2a: SizeInt = -1; slice2b: SizeInt = -1): longint; overload;`
Compares two array/slices (interleaved slice parameters, so arrayEqual(a,b,3,3) compares the first 3 elements).

`function arrayEqual(a, b: array of int64; slice1a: SizeInt = -1; slice1b: SizeInt = -1; slice2a: SizeInt = -1; slice2b: SizeInt = -1): boolean; overload;`
Tests if two array/slices are equal (interleaved slice parameters, so arrayEqual(a,b,3,3) tests the first 3 elements).

`function arrayAdd(var a: TFloatArray; const e: float):SizeInt; overload;`
Adds element `e` to array `a`. Returns i with a[i]=e.

`function arrayAdd(var a: TFloatArray; const a2: array of float):SizeInt; overload;`
Adds elements from a2 `e` to array `a`. Returns the OLD length of a.

`procedure arrayPrepend(var a: TFloatArray; const e: float); overload;`
Prepends `e` to `a`, i.e. inserts `e` at position 0. (Quite slow, O(n))

`function arrayDelete(var a: TFloatArray; const i: SizeInt):float; overload;`
Removes element at position i from a. Returns e=a[i].

`function arrayDeleteUnordered(var a: TFloatArray; const i: SizeInt):float; overload;`
Removes element at position i from a (destroying the order of the elements). Returns e=a[i].

`procedure arrayReserveFast(var a: TFloatArray; const len: SizeInt; const reserveLength: SizeInt); overload;`
Ensures that `a` has at least `reserveLength` elements.

`function arrayAddFast(var a: TFloatArray; var len: SizeInt; const e: float): SizeInt; overload;`
returns i with a[i]=e.

`procedure arrayPrependFast(var a: TFloatArray; var len: SizeInt; const e: float); overload;`
Prepends `e` to `a`, i.e. inserts `e` at position 0. (Quite slow, O(n))

`function arrayDeleteFast(var a: TFloatArray; var len: SizeInt; const i: SizeInt):float; overload;`
Removes element at position i from a. Returns e=a[i].

`function arrayDeleteUnorderedFast(var a: TFloatArray; var len: SizeInt; const i: SizeInt):float; overload;`
Removes element at position i from a (destroying the order of the elements). Returns e=a[i].

`procedure arrayInsert(var a: TFloatArray; i: SizeInt; const e: float); overload;`
Inserts element e at position i in a.

`procedure arrayInsertFast(var a: TFloatArray; var len: SizeInt; i: SizeInt; const e: float); overload;`
Inserts element e at position i in a.

`function arrayIndexOf(const a: array of float; const e: float; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
Finds element e in the array/slice (see above).

`function arrayIndexOfSmallest(const a: array of float; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
Finds the smallest element, in the array/slice (see above).

`function arrayIndexOfLargest(const a: array of float; slice1: SizeInt = -1; slice2: SizeInt = -1): SizeInt; overload;`
Finds the largest element in the array/slice (see above).

`function arrayContains(const a: array of float; const e: float; slice1: SizeInt = -1; slice2: SizeInt = -1): boolean; overload;`
Tests if element e exists in the array/slice (see above).

`procedure arrayInvert(a: TFloatArray; slice1: SizeInt = -1;slice2: SizeInt = -1); overload;`
Inverts the order of the elements in the array/slice (see above).

`function arraySlice(a: array of float; slice1: SizeInt = -1;slice2: SizeInt = -1): TFloatArray; overload;`
Extracts a array slice.

`function arrayGet(a: array of float; const i: SizeInt): float; overload;`
Returns the i-th element of the array. If i < 0, the indices are taken from the end of the array. (which is actually the only use case).

`function arrayLast(a: array of float): float; overload;`
Returns the last element of the array, raises exception, iff the array is empty.

`function arrayLast(a: array of float; const default: float): float; overload;`
Returns the last element of the array, returns default, iff the array is empty.

`function arrayCompare(a, b: array of float; slice1a: SizeInt = -1; slice1b: SizeInt = -1; slice2a: SizeInt = -1; slice2b: SizeInt = -1): longint; overload;`
Compares two array/slices (interleaved slice parameters, so arrayEqual(a,b,3,3) compares the first 3 elements).

`function arrayEqual(a, b: array of float; slice1a: SizeInt = -1; slice1b: SizeInt = -1; slice2a: SizeInt = -1; slice2b: SizeInt = -1): boolean; overload;`
Tests if two array/slices are equal (interleaved slice parameters, so `arrayEqual`(a,b,3,3) tests the first 3 elements).

`function unequal(const a, b: integer): boolean; overload;`
Checks if all elements are pairwise unequal.

`function unequal(const a, b, c: integer): boolean; overload;`
Checks if all elements are pairwise unequal.

`function unequal(const a: array of integer): boolean; overload;`
Checks if all elements are pairwise unequal.

`function unequal(const a, b: cardinal): boolean; overload;`
Checks if all elements are pairwise unequal.

`function unequal(const a, b, c: cardinal): boolean; overload;`
Checks if all elements are pairwise unequal.

`function unequal(const a: array of cardinal): boolean; overload;`
Checks if all elements are pairwise unequal.

`function unequal(const a, b: string): boolean; overload;`
Checks if all elements are pairwise unequal.

`function unequal(const a, b, c: string): boolean; overload;`
Checks if all elements are pairwise unequal.

`function unequal(const a: array of string): boolean; overload;`
Checks if all elements are pairwise unequal.

`function unequal(const a, b: int64): boolean; overload;`
Checks if all elements are pairwise unequal.

`function unequal(const a, b, c: int64): boolean; overload;`
Checks if all elements are pairwise unequal.

`function unequal(const a: array of int64): boolean; overload;`
Checks if all elements are pairwise unequal.

`function strBetween(const s, from, till: string): string;`
If the string s has the form '...fromMIDDLEtill...', it returns 'MIDDLE'.

`function strBefore(const s, sep: string): string; overload;`
If the string s has the form 'STARTsep...', it returns 'START'.

`function strAfter(const s, sep: string): string; overload;`
If the string s has the form '...sepEND', it returns 'END'.

`function strBeforeLast(const s, sep: string): string; overload;`
If the string s has the form 'STARTsep...', it returns 'START'.

`function strAfterLast(const s, sep: string): string; overload;`
If the string s has the form '...sepEND', it returns 'END'.

`function striBetween(const s, from, till: string): string;`
If the string s has the form '...fromMIDDLEtill...', it returns 'MIDDLE'.

`function striBefore(const s, sep: string): string; overload;`
If the string s has the form 'STARTsep...', it returns 'START'.

`function striAfter(const s, sep: string): string; overload;`
If the string s has the form '...sepEND', it returns 'END'.

`function striBeforeLast(const s, sep: string): string; overload;`
If the string s has the form 'STARTsep...', it returns 'START'.

`function striAfterLast(const s, sep: string): string; overload;`
If the string s has the form '...sepEND', it returns 'END'.

`function intSqrt(const i: longint): longint; overload;`

`function intSqrt(const i: int64): int64; overload;`

`function modPow(i, e, m: longint): longint; overload;`
Calculates iˆe mod m in O(log(e)) and never exceeding m.

`function intBound(min, i, max: longint): longint; overload;`
caps i at [min,max].

`function modPow(i, e, m: int64): int64; overload;`
Calculates iˆe mod m in O(log(e)) and never exceeding m.

`function intBound(min, i, max: int64): int64; overload;`
caps i at [min,max].

`function arrayBinarySearch(a: TStringArray; const value: string; choosen: TBinarySearchChoosen = bsAny; condition: TBinarySearchAcceptedConditions = [bsEqual]): SizeInt; overload;`
Binary search in a string array. `a` the ascending, sorted array. `value` the searched reference value. `choosen` which value it should return, if there are multiple possible matches. `condition` how the reference value should be compared with the values in the array (e.g. [bsGreater, bsEqual] will only return a match that is greater-or-equal-than `value`). returns the index of the found match or -1 if there is no match.

`function arrayBinarySearch(a: TLongintArray; const value: longint; choosen: TBinarySearchChoosen = bsAny; condition: TBinarySearchAcceptedConditions = [bsEqual]): SizeInt; overload;`
Binary search in a longint array. `a` the ascending, sorted array. `value` the searched reference value. `choosen` which value it should return, if there are multiple possible matches. `condition` how the reference value should be compared with the values in the array (e.g. [bsGreater, bsEqual] will only return a match that is greater-or-equal-than `value`). returns the index of the found match or -1 if there is no match.

`function arrayBinarySearch(a: TLongwordArray; const value: longword; choosen: TBinarySearchChoosen = bsAny; condition: TBinarySearchAcceptedConditions = [bsEqual]): SizeInt; overload;`
Binary search in a longword array. `a` the ascending, sorted array. `value` the searched reference value. `choosen` which value it should return, if there are multiple possible matches. `condition` how the reference value should be compared with the values in the array (e.g. [bsGreater, bsEqual] will only return a match that is greater-or-equal-than `value`). returns the index of the found match or -1 if there is no match.

`function arrayBinarySearch(a: TInt64Array; const value: int64; choosen: TBinarySearchChoosen = bsAny; condition: TBinarySearchAcceptedConditions = [bsEqual]): SizeInt; overload;`
Binary search in a int64 array. `a` the ascending, sorted array. `value` the searched reference value. `choosen` which value it should return, if there are multiple possible matches. `condition` how the reference value should be compared with the values in the array (e.g. [bsGreater, bsEqual] will only return a match that is greater-or-equal-than `value`). returns the index of the found match or -1 if there is no match.

`function arrayBinarySearch(a: TFloatArray; const value: float; choosen: TBinarySearchChoosen = bsAny; condition: TBinarySearchAcceptedConditions = [bsEqual]): SizeInt; overload;`
Binary search in a float array. `a` the ascending, sorted array. `value` the searched reference value. `choosen` which value it should return, if there are multiple possible matches. `condition` how the reference value should be compared with the values in the array (e.g. [bsGreater, bsEqual] will only return a match that is greater-or-equal-than `value`) returns the index of the found match or -1 if there is no match.

`procedure ignore(const intentionallyUnusedParameter: string); overload; inline;`
Ignores the parameter to suppress warnings.

`procedure ignore(const intentionallyUnusedParameter: boolean); overload; inline;`
Ignores the parameter to suppress warnings.

`procedure ignore(const intentionallyUnusedParameter: integer); overload; inline;`
Ignores the parameter to suppress warnings.

`procedure ignore(const intentionallyUnusedParameter: Int64); overload; inline;`
Ignores the parameter to suppress warnings.

`procedure ignore(const intentionallyUnusedParameter: TObject); overload; inline;`
Ignores the parameter to suppress warnings.

`procedure ignore(const intentionallyUnusedParameter: pointer); overload; inline;`
Ignores the parameter to suppress warnings.

### Types

`RawByteString = AnsiString;`

`TSystemCodePage = Word;`

`TStringArray=array of string;`

`TLongintArray =array of longint;`

`TSizeintArray =array of SizeInt;`

`TLongwordArray =array of longword;`

`TInt64Array =array of int64;`

`TFloatArray = array of float;`

`TCharSet = set of ansichar;`

`TProcedureOfObject = procedure () of object;`

`TStreamLikeWriteNativeInt = procedure(const Buffer; Count: NativeInt) of object;`

`TStrTrimProcedure = procedure (var p: pansichar; var l: SizeInt; const trimCharacters: TCharSet);`

`ShortStringForCaseConversion = String[7];`

`TDecodeHTMLEntitiesFlag = (...);`
Flags for strDecodeHTMLEntities ###### Values dhefStrict: Raises an exception if there are invalid entities. dhefAttribute: Aborts at = dhefWindows1252Extensions: Parses some code points as latin-1 rather than utf-8 (required for HTML5). dhefNormalizeLineEndings: Replaces line endings with #10. dhefNormalizeLineEndingsAlso85_2028: Also replace unicode line endings.

`TDecodeHTMLEntitiesFlags = set of TDecodeHTMLEntitiesFlag;`

`TFileSaveSafe = procedure (stream: TStream; data: pointer);`

`TStringViewArray = TStringView.TStringViewArray;`

`TPointerArrayList = specialize TCopyingPtrArrayList<pointer>;`

`TObjectArrayList = specialize TCopyingPtrArrayList<TObject>;`

`TSizeIntArrayList = specialize TCopyingPtrArrayList<SizeInt>;`

`TStringArrayList = specialize TCopyingPtrArrayList<String>;`

`TDateTimeParsingFlag = (...);`
###### Values dtpfStrict

`TDateTimeParsingFlags = set of TDateTimeParsingFlag;`

`TDateTimeParsingResult = (...);`
###### Values dtprSuccess dtprFailureValueTooHigh dtprFailureValueTooHigh2 dtprFailure

`TPointerCompareFunction = function (data: TObject; a, b: pointer): longint;`
Compare function to compare the two values to which a and b, ideally returning -1 for aˆ<bˆ, 0 for aˆ=bˆ, +1 for aˆ>bˆ The data is an TObject to prevent confusing it with a and b. It is the first parameter, so the function use the same calling convention as a method

`TBinarySearchChoosen = (...);`
###### Values bsAny bsFirst bsLast

`TBinarySearchAcceptedCondition = (...);`
###### Values bsLower bsEqual bsGreater

`TBinarySearchAcceptedConditions = set of TBinarySearchAcceptedCondition;`

`TBinarySearchFunction = function (data: TObject; a: pointer): longint;`
Should return 0 if the searched element is equal to a, -1 if the searched element is smaller than a, and +1 if the searched element is larger than a. (that is the opposite of what you might expect, but it is logical: the data parameter has to come first to match a method signature. The data parameter is compared to a parameter (to match a standalone comparison function signature))

### Constants

`PACKAGE_VERSION = '0.9.0.repo';`

`CP_ACP = 0;`

`CP_OEMCP = 1;`

`CP_UTF16 = 1200;`

`CP_UTF16BE = 1201;`

`CP_UTF8 = 65001;`

`CP_NONE = $FFFF;`

`CP_ASCII = 20127;`

`CP_UTF32 = 12000;`

`CP_UTF32BE = 12001;`

`CP_WINDOWS1252 = 1252;`

`CP_LATIN1 = 28591;`

`powersOf10: array[0..9] of longint = (1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000);`

`DateMonthDaysCumSum: array[false..true,0..12] of integer = ((00, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365), (00, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366));`
cumulative sum of month days (so. days in month i = dmdcs[i] - dmdcs[i-1])

`WHITE_SPACE=[#9,#10,#13,' '];`

## Author

- Benito van der Zander, (https://www.benibela.de)

Generated by PasDoc 0.16.0.