function
BytesOf(
const
Val
: RawByteString): TBytes;
var
Len:
Integer
;
begin
Len := Length(
Val
);
SetLength(Result, Len);
Move(
Val
[
1
], Result[
0
], Len);
end
;
function
BytesOf(
const
Val
: UnicodeString): TBytes;
begin
Result := TEncoding
.
Default
.
GetBytes(
Val
);
end
;
function
BytesOf(
const
Val
:
WideChar
): TBytes;
begin
Result := BytesOf(UnicodeString(
Val
));
end
;
function
BytesOf(
const
Val
:
AnsiChar
): TBytes;
begin
SetLength(Result,
1
);
Result[
0
] :=
Byte
(
Val
);
end
;