Delphi Tips Trick

For Newbie

Iklan Responsive Atas

Responsive Ads Here

Saturday, 24 September 2011

Delete Space in Delphi Programming Text

            Basically, spacing character in a text can be erased by using trim order, but limited to the spacing character in the right or left side in a certain text. Besides, it can be used to erase the character in both right and left side in a text, but it can’t be used to erase the spacing character that is between the words or letters. To do that, it needs a function that have to be made first. Give name “DeleteSpaces” for the function, the source code is;

Function Deletespace(Str: string): string;
  i: Integer;
  while i<=Length(Str) do
 if Str[i]=' ' then Delete(Str, i, 1) // this is the main order to erase spacing character “”
    else Inc(i);

            The example of the implementation is as follows:


The source code type on Button Delete Space is :
procedure TForm1.Button1Click(Sender: TObject);

I hope this article can give benefit to the visitors, readers, developer and me. Thanks for visiting and availability for sharing this article by pressing 
Share this on Facebook
or just press like button under this posting