Delphi Tips Trick

For Newbie

Iklan Responsive Atas

Responsive Ads Here

Tuesday, 27 September 2011

Delete Chararter in a Text in Delphi Programming

Delete Chararter in a Text in Delphi Programming
Sometimes it is needed erasing toward certain character from a text in component label or edit, or other components. For example, when a data in the form of “my father” will be erased * character that exist so that become “my fther”, in this case, can be made a function. Give name “DeleteString” to the function, the source code:  The example of the implementation is as follows: Source Code that is typed in delete string button is:

Function DeleteString(Str: string): string;
  i: Integer;
  while i<=Length(Str) do
 if Str[i]=' a' then Delete(Str, i, 1)// ini adalah perintah utama untuk menghapus karakter “a”
    else Inc(i);

The source code on Button1 On Click

procedure TForm1.Button1Click(Sender: TObject);

  I hope this writing 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