- Posts: 2
- Thank you received: 0
×
Discussions for CodeTyphon Object Pascal Programming Language
Question Base64 from pl_BaseLib4Pascal
- Artur
- Topic Author
- Offline
- New Member
-
Less
More
3 months 3 weeks ago #16624
by Artur
Base64 from pl_BaseLib4Pascal was created by Artur
Hello
I need Base64 for pas2js GUI application.
I found pl_BaseLib4Pascal
In the "Install / Uninstall Packages ..." window I found "pl_BaseLib4Pascal" and installed (Save and rebulid IDE). How can I benefit from it now?
There is no such tab in the list of components, and if I try to add Uses SbpBase64; I have an error: unit1.pas (9,3) Error: can't find unit "SbpSimpleBaseLibTypes".
Please help.
Windows 10, 64, Typhon 7.6
I need Base64 for pas2js GUI application.
I found pl_BaseLib4Pascal
In the "Install / Uninstall Packages ..." window I found "pl_BaseLib4Pascal" and installed (Save and rebulid IDE). How can I benefit from it now?
There is no such tab in the list of components, and if I try to add Uses SbpBase64; I have an error: unit1.pas (9,3) Error: can't find unit "SbpSimpleBaseLibTypes".
Please help.
Windows 10, 64, Typhon 7.6
Please Log in or Create an account to join the conversation.
- Robert Jenkins
- Offline
- New Member
-
Less
More
- Posts: 10
- Thank you received: 0
1 month 10 hours ago #17002
by Robert Jenkins
Replied by Robert Jenkins on topic Base64 from pl_BaseLib4Pascal
Arthur,
I just saw this post and I don't know if you got an answer to your question or not so I worked up a simple basic example. First, you don't need to "install" this package, just add it to the "Required Packages" of your project. There are no visual components so no need to install it. I created a form with two buttons and two memos. Hope this helps.
Robert
ps. I also believe there are examples included with CodeTyphon in the "CodeOcean" Examples.
Uses
SbpBase64;
{$R *.frm}
Function ToBase64(Const ABytes : TBytes) : String; Overload;
Begin
Result := TBase64.Default.Encode(ABytes);
End;
Function ToBase64(Const AString : String) : String; Overload;
Var
ABytes : TBytes;
Begin
ABytes := TEncoding.ANSI.GetAnsiBytes(AString);
Try
Result := ToBase64(ABytes);
Finally
SetLength(ABytes, 0);
End;
End;
Function FromBase64(Const AString : String) : String;
Var
ABytes : TBytes;
Begin
ABytes := TBase64.Default.Decode(AString);
Try
Result := String(TEncoding.ANSI.GetString(ABytes));
Finally
SetLength(ABytes, 0);
End;
End;
{ Tform1 }
Procedure Tform1.buttonToBase64click(Sender : Tobject);
Begin
memoBase64Text.Lines.Text := ToBase64(memoNormalText.Lines.Text);
End;
Procedure Tform1.buttonFromBase64Click(Sender : Tobject);
Begin
memoNormalText.Lines.Text := FromBase64(memoBase64Text.Lines.Text);
End;
I just saw this post and I don't know if you got an answer to your question or not so I worked up a simple basic example. First, you don't need to "install" this package, just add it to the "Required Packages" of your project. There are no visual components so no need to install it. I created a form with two buttons and two memos. Hope this helps.
Robert
ps. I also believe there are examples included with CodeTyphon in the "CodeOcean" Examples.
Uses
SbpBase64;
{$R *.frm}
Function ToBase64(Const ABytes : TBytes) : String; Overload;
Begin
Result := TBase64.Default.Encode(ABytes);
End;
Function ToBase64(Const AString : String) : String; Overload;
Var
ABytes : TBytes;
Begin
ABytes := TEncoding.ANSI.GetAnsiBytes(AString);
Try
Result := ToBase64(ABytes);
Finally
SetLength(ABytes, 0);
End;
End;
Function FromBase64(Const AString : String) : String;
Var
ABytes : TBytes;
Begin
ABytes := TBase64.Default.Decode(AString);
Try
Result := String(TEncoding.ANSI.GetString(ABytes));
Finally
SetLength(ABytes, 0);
End;
End;
{ Tform1 }
Procedure Tform1.buttonToBase64click(Sender : Tobject);
Begin
memoBase64Text.Lines.Text := ToBase64(memoNormalText.Lines.Text);
End;
Procedure Tform1.buttonFromBase64Click(Sender : Tobject);
Begin
memoNormalText.Lines.Text := FromBase64(memoBase64Text.Lines.Text);
End;
Please Log in or Create an account to join the conversation.