| Description | uses | Classes, Interfaces, Objects and Records | Functions and Procedures | Types | Constants | Variables |
This unit contains some basic functions missing in fpc
It uses the following naming convention:
All functions starting with str are related to strings and work on ansistring or pchar, so you can use them for latin1 and utf-8.
The prefix strl means the string length is given, str?i means the function is case insensitive
The prefix array means the function works with dynamical 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].
| Name | Description |
|---|---|
Class EDateTimeParsingException |
function arrayAdd(var a: TStringArray; const e: string):longint; overload; |
function arrayAdd(var a: TStringArray; const a2: TStringArray):longint; overload; |
function arrayDelete(var a: TStringArray; const i: longint):string; overload; |
procedure arrayReserveFast(var a: TStringArray; const len: longint; const reserveLength: longint); |
function arrayAddFast(var a: TStringArray; var len: longint; const e: string): longint; |
function arrayDeleteFast(var a: TStringArray; var len: longint; const i: longint):string; overload; |
function arrayIndexOf(const a: array of string; const e: string; slice1: integer = -1; slice2: integer = -1): integer; |
function arrayIndexOfSmallest(const a: array of string; slice1: integer = -1; slice2: integer = -1): integer; |
function arrayIndexOfLargest(const a: array of string; slice1: integer = -1; slice2: integer = -1): integer; |
procedure arrayInvert(a: TStringArray; slice1: integer = -1;slice2: integer = -1); overload; |
function arraySlice(a: array of string; slice1: integer = -1;slice2: integer = -1): TStringArray; |
function arrayGet(a: array of string; const i: integer): string; |
function arrayLast(a: array of string): string; |
function arrayLast(a: array of string; const default: string): string; |
function arrayCompare(a, b: array of string; slice1a: integer = -1; slice1b: integer = -1; slice2a: integer = -1; slice2b: integer = -1): longint; overload; |
function arrayEqual(a, b: array of string; slice1a: integer = -1; slice1b: integer = -1; slice2a: integer = -1; slice2b: integer = -1): boolean; overload; |
function arrayAdd(var a: TLongintArray; const e: longint):longint; overload; |
function arrayAdd(var a: TLongintArray; const a2: TLongintArray):longint; overload; |
function arrayDelete(var a: TLongintArray; const i: longint):longint; overload; |
procedure arrayReserveFast(var a: TLongintArray; const len: longint; const reserveLength: longint); |
function arrayAddFast(var a: TLongintArray; var len: longint; const e: longint): longint; |
function arrayDeleteFast(var a: TLongintArray; var len: longint; const i: longint):longint; overload; |
function arrayIndexOf(const a: array of longint; const e: longint; slice1: integer = -1; slice2: integer = -1): integer; |
function arrayIndexOfSmallest(const a: array of longint; slice1: integer = -1; slice2: integer = -1): integer; |
function arrayIndexOfLargest(const a: array of longint; slice1: integer = -1; slice2: integer = -1): integer; |
procedure arrayInvert(a: TLongintArray; slice1: integer = -1;slice2: integer = -1); overload; |
function arraySlice(a: array of longint; slice1: integer = -1;slice2: integer = -1): TLongintArray; |
function arrayGet(a: array of longint; const i: integer): longint; |
function arrayLast(a: array of longint): longint; |
function arrayLast(a: array of longint; const default: longint): longint; |
function arrayCompare(a, b: array of longint; slice1a: integer = -1; slice1b: integer = -1; slice2a: integer = -1; slice2b: integer = -1): longint; overload; |
function arrayEqual(a, b: array of longint; slice1a: integer = -1; slice1b: integer = -1; slice2a: integer = -1; slice2b: integer = -1): boolean; overload; |
function arrayAdd(var a: TLongwordArray; const e: longword):longint; overload; |
function arrayAdd(var a: TLongwordArray; const a2: TLongwordArray):longint; overload; |
function arrayDelete(var a: TLongwordArray; const i: longint):longword; overload; |
procedure arrayReserveFast(var a: TLongwordArray; const len: longint; const reserveLength: longint); |
function arrayAddFast(var a: TLongwordArray; var len: longint; const e: longword): longint; |
function arrayDeleteFast(var a: TLongwordArray; var len: longint; const i: longint):longword; overload; |
function arrayIndexOf(const a: array of longword; const e: longword; slice1: integer = -1; slice2: integer = -1): integer; |
function arrayIndexOfSmallest(const a: array of longword; slice1: integer = -1; slice2: integer = -1): integer; |
function arrayIndexOfLargest(const a: array of longword; slice1: integer = -1; slice2: integer = -1): integer; |
procedure arrayInvert(a: TLongwordArray; slice1: integer = -1;slice2: integer = -1); overload; |
function arraySlice(a: array of longword; slice1: integer = -1;slice2: integer = -1): TLongwordArray; |
function arrayGet(a: array of longword; const i: integer): longword; |
function arrayLast(a: array of longword): longword; |
function arrayLast(a: array of longword; const default: longword): longword; |
function arrayCompare(a, b: array of longword; slice1a: integer = -1; slice1b: integer = -1; slice2a: integer = -1; slice2b: integer = -1): longint; overload; |
function arrayEqual(a, b: array of longword; slice1a: integer = -1; slice1b: integer = -1; slice2a: integer = -1; slice2b: integer = -1): boolean; overload; |
function arrayAdd(var a: TInt64Array; const e: int64):longint; overload; |
function arrayAdd(var a: TInt64Array; const a2: TInt64Array):longint; overload; |
function arrayDelete(var a: TInt64Array; const i: longint):int64; overload; |
procedure arrayReserveFast(var a: TInt64Array; const len: longint; const reserveLength: longint); |
function arrayAddFast(var a: TInt64Array; var len: longint; const e: int64): longint; |
function arrayDeleteFast(var a: TInt64Array; var len: longint; const i: longint):int64; overload; |
function arrayIndexOf(const a: array of int64; const e: int64; slice1: integer = -1; slice2: integer = -1): integer; |
function arrayIndexOfSmallest(const a: array of int64; slice1: integer = -1; slice2: integer = -1): integer; |
function arrayIndexOfLargest(const a: array of int64; slice1: integer = -1; slice2: integer = -1): integer; |
procedure arrayInvert(a: TInt64Array; slice1: integer = -1;slice2: integer = -1); overload; |
function arraySlice(a: array of int64; slice1: integer = -1;slice2: integer = -1): TInt64Array; |
function arrayGet(a: array of int64; const i: integer): int64; |
function arrayLast(a: array of int64): int64; |
function arrayLast(a: array of int64; const default: int64): int64; |
function arrayCompare(a, b: array of int64; slice1a: integer = -1; slice1b: integer = -1; slice2a: integer = -1; slice2b: integer = -1): longint; overload; |
function arrayEqual(a, b: array of int64; slice1a: integer = -1; slice1b: integer = -1; slice2a: integer = -1; slice2b: integer = -1): boolean; overload; |
function arrayAdd(var a: TFloatArray; const e: float):longint; overload; |
function arrayAdd(var a: TFloatArray; const a2: TFloatArray):longint; overload; |
function arrayDelete(var a: TFloatArray; const i: longint):float; overload; |
procedure arrayReserveFast(var a: TFloatArray; const len: longint; const reserveLength: longint); |
function arrayAddFast(var a: TFloatArray; var len: longint; const e: float): longint; |
function arrayDeleteFast(var a: TFloatArray; var len: longint; const i: longint):float; overload; |
function arrayIndexOf(const a: array of float; const e: float; slice1: integer = -1; slice2: integer = -1): integer; |
function arrayIndexOfSmallest(const a: array of float; slice1: integer = -1; slice2: integer = -1): integer; |
function arrayIndexOfLargest(const a: array of float; slice1: integer = -1; slice2: integer = -1): integer; |
procedure arrayInvert(a: TFloatArray; slice1: integer = -1;slice2: integer = -1); overload; |
function arraySlice(a: array of float; slice1: integer = -1;slice2: integer = -1): TFloatArray; |
function arrayGet(a: array of float; const i: integer): float; |
function arrayLast(a: array of float): float; |
function arrayLast(a: array of float; const default: float): float; |
function arrayCompare(a, b: array of float; slice1a: integer = -1; slice1b: integer = -1; slice2a: integer = -1; slice2b: integer = -1): longint; overload; |
function arrayEqual(a, b: array of float; slice1a: integer = -1; slice1b: integer = -1; slice2a: integer = -1; slice2b: integer = -1): boolean; overload; |
function unequal(const a, b: integer): boolean; |
function unequal(const a, b, c: integer): boolean; |
function unequal(const a: array of integer): boolean; |
function unequal(const a, b: cardinal): boolean; |
function unequal(const a, b, c: cardinal): boolean; |
function unequal(const a: array of cardinal): boolean; |
function unequal(const a, b: string): boolean; |
function unequal(const a, b, c: string): boolean; |
function unequal(const a: array of string): boolean; |
function unequal(const a, b: int64): boolean; |
function unequal(const a, b, c: int64): boolean; |
function unequal(const a: array of int64): boolean; |
function procedureToMethod(proc: TProcedure): TMethod; |
procedure threadedCall(proc: TProcedureOfObject; finished: TNotifyEvent); overload; |
procedure threadedCall(proc: TProcedureOfObject; finished: TProcedureOfObject); overload; |
procedure threadedCall(proc: TProcedure; finished: TProcedureOfObject); overload; |
function strlmove(dest,source:pchar;destLen,sourceLen: longint):pchar; |
function widestrlmove(dest,source:pwidechar;destLen,sourceLen: longint):pwidechar; |
function strCopyFrom(const s:string; start:longint):string; inline; |
function strSlice(const first,last:pchar):string; |
function strSlice(const s:string; start,last:longint):string; |
function strlEqual(p1,p2:pchar;l1,l2: longint):boolean; |
function strliEqual(p1,p2:pchar;l1,l2: longint):boolean; |
function strlsEqual(p1,p2:pchar;l1,l2: longint):boolean; |
function strlsiEqual(p1,p2:pchar;l1,l2: longint):boolean; |
function strlEqual(p:pchar;const s:string; l: longint):boolean; |
function strliEqual(p:pchar;const s:string;l: longint):boolean; |
function strlBeginsWith(const p:pchar; l:longint; const expectedStart:string):boolean; |
function strliBeginsWith(const p:pchar;l: longint;const expectedStart:string):boolean; inline; |
function strEqual(const s1,s2:string):boolean; inline; |
function striEqual(const s1,s2:string):boolean; inline; |
function strBeginsWith(const strToBeExaminated,expectedStart:string):boolean; |
function striBeginsWith(const strToBeExaminated,expectedStart:string):boolean; |
function strBeginsWith(const p:pchar; const expectedStart:string):boolean; inline; |
function striBeginsWith(const p:pchar; const expectedStart:string):boolean; inline; |
function strEndsWith(const strToBeExaminated,expectedEnd:string):boolean; |
function striEndsWith(const strToBeExaminated,expectedEnd:string):boolean; |
function strCompareClever(const s1, s2: string): integer; |
function striCompareClever(const s1, s2: string): integer; inline; |
function strRpos(c:char;s:string):longint; |
function strlCount(const search:char; const searchIn:pchar; const len: longint): longint; |
function strlsIndexOf(str,searched:pchar; l1, l2: longint): longint; |
function strlsiIndexOf(str,searched:pchar; l1, l2: longint): longint; |
function strIndexOf(const str,searched:string):longint; inline; |
function striIndexOf(const str,searched:string):longint; inline; |
function strIndexOf(const str,searched:string; from: longint):longint; inline; |
function striIndexOf(const str,searched:string; from: longint):longint; inline; |
function strContains(const str,searched:string):boolean; inline; |
function striContains(const str,searched:string):boolean; inline; |
function strContains(const str,searched:string; from: longint):boolean; inline; |
function striContains(const str,searched:string; from: longint):boolean; inline; |
procedure strlTrimLeft(var p: pchar; var l: integer; const trimCharacters: TCharSet = [#0..' ']); |
procedure strlTrimRight(var p: pchar; var l: integer; const trimCharacters: TCharSet = [#0..' ']); |
procedure strlTrim(var p: pchar; var l: integer; const trimCharacters: TCharSet = [#0..' ']); |
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 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: Integer = 80; const BreakChars: TCharSet = [' ', #9]): TStringArray; |
function strWrap(const Line: string; MaxCol: Integer = 80; const BreakChars: TCharSet = [' ', #9]): 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 strJoin(const sl: TStrings; const sep: string = ', '; limit: Integer=0; const limitStr: string='...'): string; overload; |
function strJoin(const sl: TStringArray; const sep: string = ', '; limit: Integer=0; const limitStr: string='...'): string; overload; |
function StrToBoolDef(const S: string;const Def:Boolean): Boolean; |
function strLoadFromFile(filename:string):string; |
procedure strSaveToFile(filename: string;str:string); |
function strLoadFromFileUTF8(filename:string):string; |
procedure strSaveToFileUTF8(filename: string;str:string); |
function strFromSIze(size: int64):string; |
function strLengthUtf8(str: string): longint; |
function strConvertToUtf8(str: string; from: TEncoding): string; |
function strConvertFromUtf8(const str: string; toe: TEncoding): string; |
function strChangeEncoding(const str: string; from,toe: TEncoding):string; |
function strGetUnicodeCharacter(const character: integer; encoding: TEncoding = eUTF8): string; |
function strDecodeUTF8Character(const str: string; var curpos: integer): integer; |
function strEncodingFromName(str:string):TEncoding; |
function strDecodeHTMLEntities(p:pchar;l:longint;encoding:TEncoding; strict: boolean = false):string; |
function strDecodeHTMLEntities(s:string;encoding:TEncoding; strict: boolean = false):string; |
function strEscape(const s:string; const toEscape: TCharSet; escapeChar: char = '\'): string; |
function strEscapeRegex(const s:string): string; |
function strDecodeHex(const s:string):string; |
function strEncodeHex(const s:string; const code: string = '0123456789ABCDEF'):string; |
function strFromPchar(p:pchar;l:longint):string; |
function strFromPtr(p: pointer): string; |
function strFromInt(i: int64; displayLength: longint): string; |
function strDup(const rep: string; const count: integer): string; |
function intLog10(i:longint):longint; overload; |
function intLog(n,b: longint): longint; overload; |
procedure intFactor(n,p: longint; out e, r:longint); |
function gcd(a,b: cardinal): cardinal; |
function coprime(a,b:cardinal): boolean; |
function modPow(i, e, m: longint): longint; |
function intBound(min, i, max: longint): longint; |
function modPow(i, e, m: int64): int64; |
function intBound(min, i, max: int64): int64; |
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(n: integer; var totient: TLongintArray); |
procedure intSieveDivisorCount(n: integer; var divcount: TLongintArray); |
function dateWeekOfYear(const date:TDateTime):word; |
function dateIsLeapYear(const year: integer): boolean; inline; |
function dateTimeParsePartsTry(const input,mask:string; outYear, outMonth, outDay: PInteger; outHour, outMinutes, outSeconds: PInteger; outSecondFraction: PDouble = nil; outtimezone: PDateTime = nil): boolean; |
procedure dateTimeParseParts(const input,mask:string; outYear, outMonth, outDay: PInteger; outHour, outMinutes, outSeconds: PInteger; outSecondFraction: PDouble = nil; outtimezone: PDateTime = nil); |
function dateTimeFormat(const mask: string; y, m,d, h, n, s: Integer; const secondFraction: double = 0; const timezone: TDateTime = Nan): string; |
function dateTimeFormat(const mask: string; const dateTime: TDateTime): string; |
function dateTimeEncode(const y,m,d,h,n,s:integer; const secondFraction: double = 0): TDateTime; |
procedure timeParseParts(const input,mask:string; outHour, outMinutes, outSeconds: PInteger; outSecondFraction: PDouble = nil; outtimezone: PDateTime = nil); |
function timeParse(const input,mask:string): TTime; |
function timeFormat(const mask: string; const h, n, s: integer; const secondFraction: double = 0; const timezone: TDateTime = Nan): string; |
procedure dateParseParts(const input,mask:string; outYear, outMonth, outDay: PInteger; outtimezone: PDateTime = nil); |
function dateParse(const input,mask:string): longint; |
function dateFormat(const mask: string; const y, m, d: integer; const timezone: TDateTime = nan): string; |
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; size: longint; compareFunction: TPointerCompareFunction = nil; compareFunctionData: TObject=nil); |
procedure stableSort(intArray: TLongintArray; compareFunction: TPointerCompareFunction; compareFunctionData: TObject=nil); |
TStringArray=array of string; |
TLongintArray =array of longint; |
TLongwordArray =array of longword; |
TInt64Array =array of int64; |
TFloatArray =array of float; |
TProcedureOfObject = procedure () of object; |
TEncoding = (...); |
TCharSet = set of char; |
TPointerCompareFunction = function (data: TObject; a, b: pointer): longint; |
powersOf10: array[0..10] of longint = (1,10,100,1000,10000,100000,1000000,1000000,10000000,100000000,1000000000); |
DateMonthDaysCumSum: array[false..true,0..12] of Cardinal =
((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,' ']; |
function arrayAdd(var a: TStringArray; const e: string):longint; overload; |
|
Adds element |
function arrayAdd(var a: TStringArray; const a2: TStringArray):longint; overload; |
|
Adds elements from a2 |
function arrayDelete(var a: TStringArray; const i: longint):string; overload; |
|
Removes element at position i from a (destroying the order of the elements) |
procedure arrayReserveFast(var a: TStringArray; const len: longint; const reserveLength: longint); |
|
Ensures that |
function arrayAddFast(var a: TStringArray; var len: longint; const e: string): longint; |
|
returns i with a[i]=e |
function arrayDeleteFast(var a: TStringArray; var len: longint; const i: longint):string; overload; |
|
Removes element at position i from a (destroying the order of the elements) |
function arrayIndexOf(const a: array of string; const e: string; slice1: integer = -1; slice2: integer = -1): integer; |
|
Find element e in the array/slice (see above) |
function arrayIndexOfSmallest(const a: array of string; slice1: integer = -1; slice2: integer = -1): integer; |
|
Find the smallest element, in the array/slice (see above) |
function arrayIndexOfLargest(const a: array of string; slice1: integer = -1; slice2: integer = -1): integer; |
|
Find the largest element in the array/slice (see above) |
procedure arrayInvert(a: TStringArray; slice1: integer = -1;slice2: integer = -1); overload; |
|
Inverts the order of the elements in the array/slice (see above) |
function arraySlice(a: array of string; slice1: integer = -1;slice2: integer = -1): TStringArray; |
|
Extracts a array slice |
function arrayLast(a: array of string): string; |
|
Returns the last element of the array, raises exception, iff the array is empty |
function arrayLast(a: array of string; const default: string): string; |
|
Returns the last element of the array, returns default, iff the array is empty |
function arrayCompare(a, b: array of string; slice1a: integer = -1; slice1b: integer = -1; slice2a: integer = -1; slice2b: integer = -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: integer = -1; slice1b: integer = -1; slice2a: integer = -1; slice2b: integer = -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):longint; overload; |
|
Adds element |
function arrayAdd(var a: TLongintArray; const a2: TLongintArray):longint; overload; |
|
Adds elements from a2 |
function arrayDelete(var a: TLongintArray; const i: longint):longint; overload; |
|
Removes element at position i from a (destroying the order of the elements) |
procedure arrayReserveFast(var a: TLongintArray; const len: longint; const reserveLength: longint); |
|
Ensures that |
function arrayAddFast(var a: TLongintArray; var len: longint; const e: longint): longint; |
|
returns i with a[i]=e |
function arrayDeleteFast(var a: TLongintArray; var len: longint; const i: longint):longint; overload; |
|
Removes element at position i from a (destroying the order of the elements) |
function arrayIndexOf(const a: array of longint; const e: longint; slice1: integer = -1; slice2: integer = -1): integer; |
|
Find element e in the array/slice (see above) |
function arrayIndexOfSmallest(const a: array of longint; slice1: integer = -1; slice2: integer = -1): integer; |
|
Find the smallest element, in the array/slice (see above) |
function arrayIndexOfLargest(const a: array of longint; slice1: integer = -1; slice2: integer = -1): integer; |
|
Find the largest element in the array/slice (see above) |
procedure arrayInvert(a: TLongintArray; slice1: integer = -1;slice2: integer = -1); overload; |
|
Inverts the order of the elements in the array/slice (see above) |
function arraySlice(a: array of longint; slice1: integer = -1;slice2: integer = -1): TLongintArray; |
|
Extracts a array slice |
function arrayLast(a: array of longint): longint; |
|
Returns the last element of the array, raises exception, iff the array is empty |
function arrayLast(a: array of longint; const default: longint): longint; |
|
Returns the last element of the array, returns default, iff the array is empty |
function arrayCompare(a, b: array of longint; slice1a: integer = -1; slice1b: integer = -1; slice2a: integer = -1; slice2b: integer = -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: integer = -1; slice1b: integer = -1; slice2a: integer = -1; slice2b: integer = -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):longint; overload; |
|
Adds element |
function arrayAdd(var a: TLongwordArray; const a2: TLongwordArray):longint; overload; |
|
Adds elements from a2 |
function arrayDelete(var a: TLongwordArray; const i: longint):longword; overload; |
|
Removes element at position i from a (destroying the order of the elements) |
procedure arrayReserveFast(var a: TLongwordArray; const len: longint; const reserveLength: longint); |
|
Ensures that |
function arrayAddFast(var a: TLongwordArray; var len: longint; const e: longword): longint; |
|
returns i with a[i]=e |
function arrayDeleteFast(var a: TLongwordArray; var len: longint; const i: longint):longword; overload; |
|
Removes element at position i from a (destroying the order of the elements) |
function arrayIndexOf(const a: array of longword; const e: longword; slice1: integer = -1; slice2: integer = -1): integer; |
|
Find element e in the array/slice (see above) |
function arrayIndexOfSmallest(const a: array of longword; slice1: integer = -1; slice2: integer = -1): integer; |
|
Find the smallest element, in the array/slice (see above) |
function arrayIndexOfLargest(const a: array of longword; slice1: integer = -1; slice2: integer = -1): integer; |
|
Find the largest element in the array/slice (see above) |
procedure arrayInvert(a: TLongwordArray; slice1: integer = -1;slice2: integer = -1); overload; |
|
Inverts the order of the elements in the array/slice (see above) |
function arraySlice(a: array of longword; slice1: integer = -1;slice2: integer = -1): TLongwordArray; |
|
Extracts a array slice |
function arrayLast(a: array of longword): longword; |
|
Returns the last element of the array, raises exception, iff the array is empty |
function arrayLast(a: array of longword; const default: longword): longword; |
|
Returns the last element of the array, returns default, iff the array is empty |
function arrayCompare(a, b: array of longword; slice1a: integer = -1; slice1b: integer = -1; slice2a: integer = -1; slice2b: integer = -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: integer = -1; slice1b: integer = -1; slice2a: integer = -1; slice2b: integer = -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):longint; overload; |
|
Adds element |
function arrayAdd(var a: TInt64Array; const a2: TInt64Array):longint; overload; |
|
Adds elements from a2 |
function arrayDelete(var a: TInt64Array; const i: longint):int64; overload; |
|
Removes element at position i from a (destroying the order of the elements) |
procedure arrayReserveFast(var a: TInt64Array; const len: longint; const reserveLength: longint); |
|
Ensures that |
function arrayAddFast(var a: TInt64Array; var len: longint; const e: int64): longint; |
|
returns i with a[i]=e |
function arrayDeleteFast(var a: TInt64Array; var len: longint; const i: longint):int64; overload; |
|
Removes element at position i from a (destroying the order of the elements) |
function arrayIndexOf(const a: array of int64; const e: int64; slice1: integer = -1; slice2: integer = -1): integer; |
|
Find element e in the array/slice (see above) |
function arrayIndexOfSmallest(const a: array of int64; slice1: integer = -1; slice2: integer = -1): integer; |
|
Find the smallest element, in the array/slice (see above) |
function arrayIndexOfLargest(const a: array of int64; slice1: integer = -1; slice2: integer = -1): integer; |
|
Find the largest element in the array/slice (see above) |
procedure arrayInvert(a: TInt64Array; slice1: integer = -1;slice2: integer = -1); overload; |
|
Inverts the order of the elements in the array/slice (see above) |
function arraySlice(a: array of int64; slice1: integer = -1;slice2: integer = -1): TInt64Array; |
|
Extracts a array slice |
function arrayGet(a: array of int64; const i: integer): int64; |
|
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; |
|
Returns the last element of the array, raises exception, iff the array is empty |
function arrayLast(a: array of int64; const default: int64): int64; |
|
Returns the last element of the array, returns default, iff the array is empty |
function arrayCompare(a, b: array of int64; slice1a: integer = -1; slice1b: integer = -1; slice2a: integer = -1; slice2b: integer = -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: integer = -1; slice1b: integer = -1; slice2a: integer = -1; slice2b: integer = -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):longint; overload; |
|
Adds element |
function arrayAdd(var a: TFloatArray; const a2: TFloatArray):longint; overload; |
|
Adds elements from a2 |
function arrayDelete(var a: TFloatArray; const i: longint):float; overload; |
|
Removes element at position i from a (destroying the order of the elements) |
procedure arrayReserveFast(var a: TFloatArray; const len: longint; const reserveLength: longint); |
|
Ensures that |
function arrayAddFast(var a: TFloatArray; var len: longint; const e: float): longint; |
|
returns i with a[i]=e |
function arrayDeleteFast(var a: TFloatArray; var len: longint; const i: longint):float; overload; |
|
Removes element at position i from a (destroying the order of the elements) |
function arrayIndexOf(const a: array of float; const e: float; slice1: integer = -1; slice2: integer = -1): integer; |
|
Find element e in the array/slice (see above) |
function arrayIndexOfSmallest(const a: array of float; slice1: integer = -1; slice2: integer = -1): integer; |
|
Find the smallest element, in the array/slice (see above) |
function arrayIndexOfLargest(const a: array of float; slice1: integer = -1; slice2: integer = -1): integer; |
|
Find the largest element in the array/slice (see above) |
procedure arrayInvert(a: TFloatArray; slice1: integer = -1;slice2: integer = -1); overload; |
|
Inverts the order of the elements in the array/slice (see above) |
function arraySlice(a: array of float; slice1: integer = -1;slice2: integer = -1): TFloatArray; |
|
Extracts a array slice |
function arrayGet(a: array of float; const i: integer): float; |
|
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; |
|
Returns the last element of the array, raises exception, iff the array is empty |
function arrayLast(a: array of float; const default: float): float; |
|
Returns the last element of the array, returns default, iff the array is empty |
function arrayCompare(a, b: array of float; slice1a: integer = -1; slice1b: integer = -1; slice2a: integer = -1; slice2b: integer = -1): longint; overload; |
|
Compares two array/slices (interleaved slice parameters, so arrayEqual(a,b,3,3) compares the first 3 elements) |
function unequal(const a, b: integer): boolean; |
|
Checks if all elements are pairwise unequal |
function unequal(const a, b, c: integer): boolean; |
|
Checks if all elements are pairwise unequal |
function unequal(const a: array of integer): boolean; |
|
Checks if all elements are pairwise unequal |
function unequal(const a, b: cardinal): boolean; |
|
Checks if all elements are pairwise unequal |
function unequal(const a, b, c: cardinal): boolean; |
|
Checks if all elements are pairwise unequal |
function unequal(const a: array of cardinal): boolean; |
|
Checks if all elements are pairwise unequal |
function unequal(const a, b: string): boolean; |
|
Checks if all elements are pairwise unequal |
function unequal(const a, b, c: string): boolean; |
|
Checks if all elements are pairwise unequal |
function unequal(const a: array of string): boolean; |
|
Checks if all elements are pairwise unequal |
function unequal(const a, b: int64): boolean; |
|
Checks if all elements are pairwise unequal |
function unequal(const a, b, c: int64): boolean; |
|
Checks if all elements are pairwise unequal |
function unequal(const a: array of int64): boolean; |
|
Checks if all elements are pairwise unequal |
function procedureToMethod(proc: TProcedure): TMethod; |
procedure threadedCall(proc: TProcedureOfObject; finished: TNotifyEvent); overload; |
|
Calls proc in an new thread |
procedure threadedCall(proc: TProcedureOfObject; finished: TProcedureOfObject); overload; |
|
Calls proc in an new thread |
procedure threadedCall(proc: TProcedure; finished: TProcedureOfObject); overload; |
|
Calls proc in an new thread |
function strlmove(dest,source:pchar;destLen,sourceLen: longint):pchar; |
|
Copies min(sourceLen, destLen) characters from source to dest and returns dest |
function widestrlmove(dest,source:pwidechar;destLen,sourceLen: longint):pwidechar; |
|
Copies min(sourceLen, destLen) characters from source to dest and returns dest |
function strCopyFrom(const s:string; start:longint):string; inline; |
|
Returns the substring of s containing all characters after start (including s[start] |
function strSlice(const first,last:pchar):string; |
|
Returns a string with all characters between first and last (including first, last) |
function strSlice(const s:string; start,last:longint):string; |
|
Returns a string with all characters between start and last (including start, last) |
function strlEqual(p1,p2:pchar;l1,l2: longint):boolean; |
|
Tests if the strings are case-sensitive equal (same length and same characters) (null-terminated, stops comparison when meeting #0 ) |
function strliEqual(p1,p2:pchar;l1,l2: longint):boolean; |
|
Tests if the strings are case-insensitive equal (same length and same characters) (null-terminated, stops comparison when meeting #0 ) |
function strlsEqual(p1,p2:pchar;l1,l2: longint):boolean; |
|
Tests if the strings are case-sensitive equal (same length and same characters) (strict-length, can continue comparison after #0) |
function strlsiEqual(p1,p2:pchar;l1,l2: longint):boolean; |
|
Tests if the strings are case-insensitive equal (same length and same characters) (strict-length, can continue comparison after #0) |
function strlEqual(p:pchar;const s:string; l: longint):boolean; |
|
Tests if the strings are case-sensitive equal (same length and same characters) |
function strliEqual(p:pchar;const s:string;l: longint):boolean; |
|
Tests if the strings are case-insensitive equal (same length and same characters) |
function strlBeginsWith(const p:pchar; l:longint; const expectedStart:string):boolean; |
|
Test if p begins with expectedStart (__STRICT_HELP__, case-sensitive) |
function strliBeginsWith(const p:pchar;l: longint;const expectedStart:string):boolean; inline; |
|
Test if p begins with expectedStart (__STRICT_HELP__, case-insensitive) |
function strEqual(const s1,s2:string):boolean; inline; |
|
Tests if the strings are case-insensitive equal (same length and same characters) |
function striEqual(const s1,s2:string):boolean; inline; |
|
Tests if the strings are case-insensitive equal (same length and same characters) |
function strBeginsWith(const strToBeExaminated,expectedStart:string):boolean; |
|
Tests if the |
function striBeginsWith(const strToBeExaminated,expectedStart:string):boolean; |
|
Tests if the |
function strBeginsWith(const p:pchar; const expectedStart:string):boolean; inline; |
|
Tests if the |
function striBeginsWith(const p:pchar; const expectedStart:string):boolean; inline; |
|
Tests if the |
function strEndsWith(const strToBeExaminated,expectedEnd:string):boolean; |
|
Tests if the |
function striEndsWith(const strToBeExaminated,expectedEnd:string):boolean; |
|
Tests if the |
function strCompareClever(const s1, s2: string): integer; |
|
Case sensitive, clever comparison, that basically splits the string into lexicographical and numerical parts and compares them accordingly |
function strRpos(c:char;s:string):longint; |
|
Searchs the last index of c in s |
function strlCount(const search:char; const searchIn:pchar; const len: longint): longint; |
|
Counts all occurrences of search in searchIn (case sensitive, stops at #0) |
function strlsIndexOf(str,searched:pchar; l1, l2: longint): longint; |
|
Searchs |
function strlsiIndexOf(str,searched:pchar; l1, l2: longint): longint; |
|
Searchs |
function strIndexOf(const str,searched:string):longint; inline; |
|
Searchs |
function striIndexOf(const str,searched:string):longint; inline; |
|
Searchs |
function strIndexOf(const str,searched:string; from: longint):longint; inline; |
|
Searchs |
function striIndexOf(const str,searched:string; from: longint):longint; inline; |
|
Searchs |
function strContains(const str,searched:string):boolean; inline; |
|
Tests if |
function striContains(const str,searched:string):boolean; inline; |
|
Tests if |
function strContains(const str,searched:string; from: longint):boolean; inline; |
|
Tests if |
function striContains(const str,searched:string; from: longint):boolean; inline; |
|
Tests if |
procedure strlTrimLeft(var p: pchar; var l: integer; const trimCharacters: TCharSet = [#0..' ']); |
|
Removes all occurrences of trimCharacter from the left/right side of the string |
procedure strlTrimRight(var p: pchar; var l: integer; const trimCharacters: TCharSet = [#0..' ']); |
|
Removes all occurrences of trimCharacter from the left/right side of the string |
procedure strlTrim(var p: pchar; var l: integer; const trimCharacters: TCharSet = [#0..' ']); |
|
Removes all occurrences of trimCharacter from the left/right side of the string |
function strTrimLeft(const s:string; const trimCharacters: TCharSet = [#0..' ']):string; inline; |
|
Removes all occurrences of trimCharacter from the left/right side of the string |
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; |
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: Integer = 80; const BreakChars: TCharSet = [' ', #9]): TStringArray; |
function strWrap(const Line: string; MaxCol: Integer = 80; const BreakChars: TCharSet = [' ', #9]): 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 strJoin(const sl: TStringArray; const sep: string = ', '; limit: Integer=0; const limitStr: string='...'): string; overload; |
|
Joins all string list items to a single string separated by |
function StrToBoolDef(const S: string;const Def:Boolean): Boolean; |
|
Converts a str to a bool (for fpc versions previous 2.2) |
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 |
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 |
function strLoadFromFileUTF8(filename:string):string; |
|
loads a file as string. The filename should be encoded in utf-8 See also |
procedure strSaveToFileUTF8(filename: string;str:string); |
|
saves a string as file. The filename should be encoded in utf-8 See also |
function strFromSIze(size: int64):string; |
|
converts a size (measured in bytes) to a string (e.g. 1025 -> 1 KiB) |
function strConvertToUtf8(str: string; from: TEncoding): string; |
|
Returns a utf-8 string from the string in encoding |
function strConvertFromUtf8(const str: string; toe: TEncoding): string; |
|
Converts a utf-8 string to the encoding |
function strChangeEncoding(const str: string; from,toe: TEncoding):string; |
|
Changes the string encoding from |
function strGetUnicodeCharacter(const character: integer; encoding: TEncoding = eUTF8): string; |
|
Get unicode character |
function strEncodingFromName(str:string):TEncoding; |
|
Gets the encoding from an encoding name (e.g. from http-equiv) |
function strDecodeHTMLEntities(p:pchar;l:longint;encoding:TEncoding; strict: boolean = false):string; |
|
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:TEncoding; strict: boolean = false):string; |
|
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(const s:string; const toEscape: TCharSet; escapeChar: char = '\'): string; |
|
Replace all occurences of x \in toEscape with escapeChar + x |
function strEscapeRegex(const s:string): string; |
|
Returns a regex matching s |
function strDecodeHex(const s:string):string; |
function strEncodeHex(const s:string; const code: string = '0123456789ABCDEF'):string; |
function strFromPchar(p:pchar;l:longint):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 strDup(const rep: string; const count: integer): string; |
|
Creates count copies of rep |
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(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: cardinal): cardinal; |
|
Calculates the greatest common denominator |
function coprime(a,b:cardinal): boolean; |
|
Checks if two numbers are |
function modPow(i, e, m: longint): longint; |
|
Calculates iˆe mod m in O(log(e)) and never exceeding m |
function intBound(min, i, max: longint): longint; |
function modPow(i, e, m: int64): int64; |
|
Calculates iˆe mod m in O(log(e)) and never exceeding m |
function intBound(min, i, max: int64): int64; |
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 |
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 |
function binomialZScore(n:longint;p:float;k:longint):float; |
|
Z-Score of the value k in a distribution with n outcomes |
procedure intSieveEulerPhi(n: integer; var totient: TLongintArray); |
|
This calculates the euler phi function totient[i] := phi(i) = |{1 <= j <= i | gcd(i,j) = 0}| for all i <= n. |
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. |
function dateWeekOfYear(const date:TDateTime):word; |
|
Week of year |
function dateIsLeapYear(const year: integer): boolean; inline; |
Returnsif year is a leap year (supports negative years, i think) |
procedure dateTimeParseParts(const input,mask:string; outYear, outMonth, outDay: PInteger; outHour, outMinutes, outSeconds: PInteger; outSecondFraction: PDouble = nil; outtimezone: PDateTime = nil); |
|
Reads date/time parts from a input matching a given mask (@see dateTimeParsePartsTry) |
function dateTimeFormat(const mask: string; y, m,d, h, n, s: Integer; const secondFraction: double = 0; const timezone: TDateTime = Nan): string; |
|
Converts a dateTime to a string corresponding to the given mask (same mask as dateTimeParsePartsTry) |
function dateTimeFormat(const mask: string; const dateTime: TDateTime): string; |
|
Converts a dateTime to a string corresponding to the given mask (same mask as dateTimeParsePartsTry) |
function dateTimeEncode(const y,m,d,h,n,s:integer; const secondFraction: double = 0): TDateTime; |
|
Encodes a date time |
procedure timeParseParts(const input,mask:string; outHour, outMinutes, outSeconds: PInteger; outSecondFraction: PDouble = nil; outtimezone: PDateTime = nil); |
|
Reads a time string given a certain mask (@see dateTimeParsePartsTry) |
function timeParse(const input,mask:string): TTime; |
|
Reads a time string given a certain mask (@see dateTimeParsePartsTry). |
function timeFormat(const mask: string; const h, n, s: integer; const secondFraction: double = 0; const timezone: TDateTime = Nan): string; |
|
Converts a dateTime to a string corresponding to the given mask (same mask as dateTimeParsePartsTry) |
procedure dateParseParts(const input,mask:string; outYear, outMonth, outDay: PInteger; outtimezone: PDateTime = nil); |
|
Reads a date string given a certain mask (@see dateTimeParsePartsTry) |
function dateParse(const input,mask:string): longint; |
|
Reads a date string given a certain mask (@see dateTimeParsePartsTry) |
function dateFormat(const mask: string; const y, m, d: integer; const timezone: TDateTime = nan): string; |
|
Converts a dateTime to a string corresponding to the given mask (same mask as dateTimeParsePartsTry) |
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; size: longint; compareFunction: TPointerCompareFunction = nil; compareFunctionData: TObject=nil); |
|
General stable sort function |
procedure stableSort(intArray: TLongintArray; compareFunction: TPointerCompareFunction; compareFunctionData: TObject=nil); |
|
general stable sort function (using merge + insert sort in the moment) |
TStringArray=array of string; |
TLongintArray =array of longint; |
TLongwordArray =array of longword; |
TInt64Array =array of int64; |
TFloatArray =array of float; |
TProcedureOfObject = procedure () of object; |
TEncoding = (...); |
Values
|
TCharSet = set of char; |
powersOf10: array[0..10] of longint = (1,10,100,1000,10000,100000,1000000,1000000,10000000,100000000,1000000000); |
WHITE_SPACE=[#9,#10,#13,' ']; |