The title might be a bit confusing, but basically, I want a function that can minify Delphi code.
Something like this:
function MinifyDelphiCode(delphi: String): String;
begin
// Returns the minified Delphi (.pas) code String
end;
Is there by any chance a built-in function or a library for this? or does anyone have a function that already does this?
Here's an example of what I would expect in terms of input and output:
Input:
unit Unit2;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, System.Skia,
FMX.Controls.Presentation, FMX.StdCtrls, FMX.Skia;
type
TForm2 = class(TForm)
SkSvg1: TSkSvg;
Button1: TButton;
RadioButton1: TRadioButton;
CheckBox1: TCheckBox;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.fmx}
{
gas
dgsgdsdgs
gdsdgs
dgssdgdg
}
procedure TForm2.Button1Click(Sender: TObject);
// Some comment
begin
ShowMessage('Hello World'); // Random comment that I put here
end;
end.
Output:
unit Unit2; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, System.Skia, FMX.Controls.Presentation, FMX.StdCtrls, FMX.Skia; type TForm2 = class(TForm) SkSvg1: TSkSvg; Button1: TButton; RadioButton1: TRadioButton; CheckBox1: TCheckBox; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form2: TForm2; implementation {$R *.fmx} { gas dgsgdsdgs gdsdgs dgssdgdg } procedure TForm2.Button1Click(Sender: TObject); begin ShowMessage('Hello World'); end; end.
It doesn't need to be exactly like my output. My output is just an example.