Te pongo un ejemplo para que lo adaptes, pero te servirá de referencia:
He creado un proyecto nuevo y en el formulario he añadido un par de etiquetas, un par de edits y un botón:
bt1: TButton;
ed1: TEdit;
ed2: TEdit;
lb1: TLabel;
lb2: TLabel;
Y este es el código completo del programita:
Código Delphi
[-]
unit Unit25;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
bt1: TButton;
ed1: TEdit;
ed2: TEdit;
lb1: TLabel;
lb2: TLabel;
procedure bt1Click(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.bt1Click(Sender: TObject);
const
_CLAVE_ = 'TERMINADOS';
var
cPrecio : string;
fPrecio : double;
iX,
iNum : integer;
cSalida : string;
begin
ed2.Text := '';
cSalida := '';
if ed1.Text='' then
fPrecio := 1234567890
else
fPrecio := StrToFloat(ed1.Text);
cPrecio := FloatToStr(fPrecio);
for iX:=1 to length(cPrecio) do
begin
if pos(cPrecio[iX],'1234567890')>0 then
begin
iNum := StrToInt(cPrecio[iX]);
if iNum=0 then
iNum := 10;
cSalida := cSalida + _CLAVE_[ iNum ];
end
else
cSalida := cSalida + cPrecio[iX];
end;
ed2.Text := cSalida;
end;
end.
Es sólo un ejemplo, se puede hacer de otras formas, ahora sólo hace falta que lo adaptes.
Y aquí la pantallita: