* Add BinStr

This commit is contained in:
michael 2020-04-25 16:23:30 +00:00
parent 2d309499e9
commit 4ec47938ee

View File

@ -92,6 +92,11 @@ type
TDynArrayIndex = NativeInt;
TTextLineBreakStyle = (tlbsLF,tlbsCRLF,tlbsCR);
TCompareOption = ({coLingIgnoreCase, coLingIgnoreDiacritic, }coIgnoreCase{,
coIgnoreKanaType, coIgnoreNonSpace, coIgnoreSymbols, coIgnoreWidth,
coLingCasing, coDigitAsNumbers, coStringSort});
TCompareOptions = set of TCompareOption;
{*****************************************************************************
TObject, TClass, IUnknown, IInterface, TInterfacedObject
*****************************************************************************}
@ -360,6 +365,7 @@ function Pos(const Search, InString: String; StartAt : Integer): Integer; assemb
procedure Insert(const Insertion: String; var Target: String; Index: Integer); overload;
function upcase(c : char) : char; assembler;
function HexStr(Val: NativeInt; cnt: byte): string; external name 'rtl.hexStr'; overload;
function binstr(val : int64; cnt : byte) : string;
procedure val(const S: String; out NI : NativeInt; out Code: Integer); overload;
procedure val(const S: String; out NI : NativeUInt; out Code: Integer); overload;
@ -710,6 +716,18 @@ begin
Code:=1;
end;
function binstr(val : int64;cnt : byte) : string;
var
i : Integer;
begin
SetLength(Result,cnt);
for i:=cnt downto 1 do
begin
Result[i]:=char(48+val and 1);
val:=val shr 1;
end;
end;
function upcase(c : char) : char; assembler;
asm
return c.toUpperCase();