maxkleiner / maXbox4

code compiler script studio
GNU General Public License v3.0
23 stars 10 forks source link

InttoBytes #24

Closed maxkleiner closed 1 year ago

maxkleiner commented 3 years ago
function InttoBytes(const Cint: Integer): TBytes;
begin
  result[0]:= Cint and $FF;
  result[1]:= (Cint shr 8) and $FF;
  result[2]:= (Cint shr 16) and $FF;
end;
maxkleiner commented 3 years ago

or

 function ByteToString(var Value: TBytes): String;  // var and const OK!
var I: integer;
    S : String;
    Letra: char;
begin
    S := '';
    for I := Length(Value)-1 Downto 0 do begin
        letra := Chr(Value[I] + 48);
        S := letra + S;
    end;
    Result := S;
end;
maxkleiner commented 1 year ago

Func StrToBytes(const Value:Str): TBytes; Func BytesToStr(const Value: TBytes):Str; Func GetBytes(value:Str): TBytes; Func GetBytesInt(value: Smallint): TBytes; Function StreamToBytes( const ASource : TStream) : TBytes');

maxkleiner commented 1 year ago

9 flcSysUtils.pas //2 functions with cwindows possible + freqObj +TBytes utils Func AnsiBytesOf(const S:Str): TBytes; Func GetBytes(value:Str): TBytes; Func GetBytesInt(value: Smallint): TBytes; Func AnsiByteArrayStringLen2(Data: TBytes): Integer; Func StringToAnsiByteArray2(const S:Str): TBytes; Func AnsiByteArrayToString2(const Data: TBytes; Count: Integer):Str; Func BytesOf(const Value: Ansistr): TBytes; Func BytesOfChar(const Value: AnsiChar): TBytes; Func StringOf(const Bytes: array of Byte): Ansistr;