Unit bbutils
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
andtime
, 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
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 |
function striBeginsWith(const strToBeExaminated,expectedStart:string):boolean; overload; |
Tests if |
function strBeginsWith(const p:pansichar; const expectedStart:string):boolean; overload; inline; |
Tests if |
function striBeginsWith(const p:pansichar; const expectedStart:string):boolean; overload; inline; |
Tests if |
function strEndsWith(const strToBeExaminated,expectedEnd:string):boolean; |
Tests if |
function striEndsWith(const strToBeExaminated,expectedEnd:string):boolean; |
Tests if |
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 |
function strlsIndexOf(str:pansichar; const searched: TCharSet; length: SizeInt): SizeInt; overload; |
Searchs |
function strlsiIndexOf(str,searched:pansichar; l1, l2: SizeInt): SizeInt; |
Searchs |
function strIndexOf(const str,searched:string):SizeInt; overload; inline; |
Searchs |
function strIndexOf(const str: string; const searched: TCharSet):SizeInt; overload; inline; |
Searchs |
function striIndexOf(const str,searched:string):SizeInt; overload; inline; |
Searchs |
function strIndexOf(const str,searched:string; from: SizeInt):SizeInt; overload; inline; |
Searchs |
function strIndexOf(const str: string; const searched: TCharSet; from: SizeInt):SizeInt; overload; inline; |
Searchs |
function striIndexOf(const str,searched:string; from: SizeInt):SizeInt; overload; inline; |
Searchs |
function strlsLastIndexOf(str,searched:pansichar; l1, l2: SizeInt): SizeInt; overload; |
Searchs |
function strlsLastIndexOf(str:pansichar; const searched: TCharSet; length: SizeInt): SizeInt; overload; |
Searchs |
function strlsiLastIndexOf(str,searched:pansichar; l1, l2: SizeInt): SizeInt; |
Searchs |
function strLastIndexOf(const str: string; const searched: string):SizeInt; overload; inline; |
Searchs the last occurrence of |
function strLastIndexOf(const str: string; const searched: string; from: SizeInt):SizeInt; overload; inline; |
Searchs the last occurrence of |
function strLastIndexOf(const str: string; const searched: TCharSet):SizeInt; overload; inline; |
Searchs the last occurrence of |
function strLastIndexOf(const str: string; const searched: TCharSet; from: SizeInt):SizeInt; overload; inline; |
Searchs the last occurrence of |
function striLastIndexOf(const str: string; const searched: string):SizeInt; overload; inline; |
Searchs the last occurrence of |
function striLastIndexOf(const str: string; const searched: string; from: SizeInt):SizeInt; overload; inline; |
Searchs the last occurrence of |
function strContains(const str,searched:string):boolean; overload; inline; |
Tests if |
function strContains(const str:string; const searched: TCharSet):boolean; overload; inline; |
Tests if |
function striContains(const str,searched:string):boolean; overload; inline; |
Tests if |
function strContains(const str,searched:string; from: SizeInt):boolean; overload; inline; |
Tests if |
function strContains(const str:string; const searched: TCharSet; from: SizeInt):boolean; overload; inline; |
Tests if |
function striContains(const str,searched:string; from: SizeInt):boolean; overload; inline; |
Tests if |
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. |
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. |
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. |
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 |
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 |
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
|
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:RawByteString): string; |
Loads a file as string. The filename should be encoded in utf-8. See also
|
procedure strSaveToFileUTF8(filename: RawByteString; 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 strLengthUtf8(const str: RawByteString; out invalid: SizeInt): SizeInt; |
length of an utf8 string. Parameters
|
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 |
function strConvertFromUtf8(str: RawByteString; toe: TSystemCodePage): RawByteString; |
Convert a string from UTF-8 to the encoding |
function strConvert(const str: RawByteString; from, toCP: TSystemCodePage): RawByteString; |
Converts a string from one encoding to another. |
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 |
function strGetUnicodeCharacter(const character: integer; encoding: TSystemCodePage = CP_UTF8): RawByteString; |
Gets unicode character |
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 |
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 |
function strDecodeUTF8Character(var currentpos: pchar; afterlast: PChar): integer; overload; |
Returns the unicode code point of the utf-8 character starting at |
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. |
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. |
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. |
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. |
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 |
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(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. |
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; overload; |
Week of year |
function dateWeekOfYear(year, month, day: integer):word; overload; |
function dateIsLeapYear(const year: integer): boolean; inline; |
Returnsif 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:
The letter formats d/y/h/n/s matches one or two digits, the dd/mm/yy formats require exactly two. ReturnsIf 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
|
function dateTimeParse(const input,mask:string; outtimezone: PInteger = nil): TDateTime; |
Reads date/time from a input matching a given mask See also
|
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
|
function timeParse(const input,mask:string): TTime; |
Reads a time string given a certain mask . See also
|
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
|
function dateParse(const input,mask:string): longint; |
Reads a date string given a certain mask . See also
|
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) Parameters
|
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. |
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 |
function arrayAdd(var a: TStringArray; const a2: array of string):SizeInt; overload; |
Adds elements from a2 |
procedure arrayPrepend(var a: TStringArray; const e: string); overload; |
Prepends |
function arrayDelete(var a: TStringArray; const i: SizeInt):string; overload; |
Removes element at position i from a. |
function arrayDeleteUnordered(var a: TStringArray; const i: SizeInt):string; overload; |
Removes element at position i from a (destroying the order of the elements). |
procedure arrayReserveFast(var a: TStringArray; const len: SizeInt; const reserveLength: SizeInt); overload; |
Ensures that |
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 |
function arrayDeleteFast(var a: TStringArray; var len: SizeInt; const i: SizeInt):string; overload; |
Removes element at position i from a. |
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). |
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 |
function arrayAdd(var a: TLongintArray; const a2: array of longint):SizeInt; overload; |
Adds elements from a2 |
procedure arrayPrepend(var a: TLongintArray; const e: longint); overload; |
Prepends |
function arrayDelete(var a: TLongintArray; const i: SizeInt):longint; overload; |
Removes element at position i from a. |
function arrayDeleteUnordered(var a: TLongintArray; const i: SizeInt):longint; overload; |
Removes element at position i from a (destroying the order of the elements). |
procedure arrayReserveFast(var a: TLongintArray; const len: SizeInt; const reserveLength: SizeInt); overload; |
Ensures that |
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 |
function arrayDeleteFast(var a: TLongintArray; var len: SizeInt; const i: SizeInt):longint; overload; |
Removes element at position i from a. |
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). |
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 |
function arrayAdd(var a: TLongwordArray; const a2: array of longword):SizeInt; overload; |
Adds elements from a2 |
procedure arrayPrepend(var a: TLongwordArray; const e: longword); overload; |
Prepends |
function arrayDelete(var a: TLongwordArray; const i: SizeInt):longword; overload; |
Removes element at position i from a, |
function arrayDeleteUnordered(var a: TLongwordArray; const i: SizeInt):longword; overload; |
Removes element at position i from a (destroying the order of the elements), |
procedure arrayReserveFast(var a: TLongwordArray; const len: SizeInt; const reserveLength: SizeInt); overload; |
Ensures that |
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 |
function arrayDeleteFast(var a: TLongwordArray; var len: SizeInt; const i: SizeInt):longword; overload; |
Removes element at position i from a, |
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), |
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 |
function arrayAdd(var a: TInt64Array; const a2: array of int64):SizeInt; overload; |
Adds elements from a2 |
procedure arrayPrepend(var a: TInt64Array; const e: int64); overload; |
Prepends |
function arrayDelete(var a: TInt64Array; const i: SizeInt):int64; overload; |
Removes element at position i from a. |
function arrayDeleteUnordered(var a: TInt64Array; const i: SizeInt):int64; overload; |
Removes element at position i from a (destroying the order of the elements). |
procedure arrayReserveFast(var a: TInt64Array; const len: SizeInt; const reserveLength: SizeInt); overload; |
Ensures that |
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 |
function arrayDeleteFast(var a: TInt64Array; var len: SizeInt; const i: SizeInt):int64; overload; |
Removes element at position i from a. |
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). |
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 |
function arrayAdd(var a: TFloatArray; const a2: array of float):SizeInt; overload; |
Adds elements from a2 |
procedure arrayPrepend(var a: TFloatArray; const e: float); overload; |
Prepends |
function arrayDelete(var a: TFloatArray; const i: SizeInt):float; overload; |
Removes element at position i from a. |
function arrayDeleteUnordered(var a: TFloatArray; const i: SizeInt):float; overload; |
Removes element at position i from a (destroying the order of the elements). |
procedure arrayReserveFast(var a: TFloatArray; const len: SizeInt; const reserveLength: SizeInt); overload; |
Ensures that |
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 |
function arrayDeleteFast(var a: TFloatArray; var len: SizeInt; const i: SizeInt):float; overload; |
Removes element at position i from a. |
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). |
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 |
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. |
function arrayBinarySearch(a: TLongintArray; const value: longint; choosen: TBinarySearchChoosen = bsAny; condition: TBinarySearchAcceptedConditions = [bsEqual]): SizeInt; overload; |
Binary search in a longint array. |
function arrayBinarySearch(a: TLongwordArray; const value: longword; choosen: TBinarySearchChoosen = bsAny; condition: TBinarySearchAcceptedConditions = [bsEqual]): SizeInt; overload; |
Binary search in a longword array. |
function arrayBinarySearch(a: TInt64Array; const value: int64; choosen: TBinarySearchChoosen = bsAny; condition: TBinarySearchAcceptedConditions = [bsEqual]): SizeInt; overload; |
Binary search in a int64 array. |
function arrayBinarySearch(a: TFloatArray; const value: float; choosen: TBinarySearchChoosen = bsAny; condition: TBinarySearchAcceptedConditions = [bsEqual]): SizeInt; overload; |
Binary search in a float array. |
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
|
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
|
TDateTimeParsingFlags = set of TDateTimeParsingFlag; |
TDateTimeParsingResult = (...); |
Values
|
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
|
TBinarySearchAcceptedCondition = (...); |
Values
|
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
Generated by PasDoc 0.16.0.