Skip to content

Commit f484b9c

Browse files
committed
[base64] added new methods
1 parent 6a58827 commit f484b9c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Quick.Base64.pas

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
interface
3434

3535
uses
36+
System.SysUtils,
3637
{$IFDEF DELPHIXE7_UP}
3738
System.NetEncoding;
3839
{$ELSE}
@@ -42,6 +43,10 @@ interface
4243

4344
function Base64Encode(const Input: string): string;
4445
function Base64Decode(const Input: string): string;
46+
{$IFDEF DELPHIXE7_UP}
47+
function Base64DecodeFromBinary(const Input: string) : string;
48+
function Base64DecodeToBytes(const Input: string) : TBytes;
49+
{$ENDIF}
4550

4651
implementation
4752

@@ -63,5 +68,20 @@ function Base64Decode(const Input: string): string;
6368
{$ENDIF}
6469
end;
6570

71+
{$IFDEF DELPHIXE7_UP}
72+
function Base64DecodeFromBinary(const Input: string) : string;
73+
var
74+
b : TBytes;
75+
begin
76+
b := TNetEncoding.Base64.DecodeStringToBytes(Input);
77+
Result := TEncoding.ANSI.GetString(b);
78+
end;
79+
80+
function Base64DecodeToBytes(const Input: string) : TBytes;
81+
begin
82+
Result := TNetEncoding.Base64.DecodeStringToBytes(Input);
83+
end;
84+
{$ENDIF}
85+
6686
end.
6787

0 commit comments

Comments
 (0)