Ver Mensaje Individual
  #5  
Antiguo 09-05-2011
gdlrinfo gdlrinfo is offline
Miembro
 
Registrado: may 2007
Posts: 131
Reputación: 20
gdlrinfo Va por buen camino
Cita:
Empezado por Casimiro Notevi Ver Mensaje
Explicas poca cosa, pero lo normal es que pongas una máscara apropiada, algo así como: '#,##0.00'
Que tal Casimiro en verdad nose que mas necesitas saber quiza me exprese mal lo que yo quiero es que al sumarse los dos numero no me quite el cero del decimal pongo un ejemplo para que sea mas practico y desde ya muchas gracias
Código Delphi [-]
function StrToFloat_Universal( pText : string ): Extended; const    EUROPEAN_ST = ',';
 AMERICAN_ST = '.'; var   lformatSettings : TFormatSettings;
 lFinalValue     : string;
 //lAmStDecimalPos : integer;
 lIndx           : Byte;
 lIsAmerican     : Boolean;
 lIsEuropean     : Boolean;
 begin   lIsAmerican := False;
    lIsEuropean := False;
     for lIndx := Length( pText ) - 1 downto 0 do
     begin
     if ( pText[ lIndx ] = AMERICAN_ST ) then
     begin
     lIsAmerican := True;
     pText := StringReplace( pText, ',', '', [ rfIgnoreCase, rfReplaceAll ]);
     //get rid of thousand incidental separators
      Break;
      end;
      if ( pText[ lIndx ] = EUROPEAN_ST ) then
      begin
      lIsEuropean := True;
      pText := StringReplace( pText, '.', '', [ rfIgnoreCase, rfReplaceAll ]);  //get rid of thousand incidental separators
      Break;     end;   end;   GetLocaleFormatSettings( LOCALE_SYSTEM_DEFAULT, lformatSettings );
      if ( lformatSettings.DecimalSeparator = EUROPEAN_ST ) then
      begin
      if lIsAmerican then
      begin
      lFinalValue := StringReplace( pText, '.', ',', [ rfIgnoreCase, rfReplaceAll ] );
      end;
      end;
      if ( lformatSettings.DecimalSeparator = AMERICAN_ST ) then
      begin
      if lIsEuropean then
      begin
      lFinalValue := StringReplace( pText, ',', '.', [ rfIgnoreCase, rfReplaceAll ] );
      end;
      end;
      pText  := lFinalValue;   Result := StrToFloat( pText, lformatSettings );
      end;
procedure TForm1.Button1Click(Sender: TObject);
var
N1:Real;
Begin
N1:= StrToFloat_Universal (Edit1.Text);
N1:= N1 + StrToFloat_Universal( Edit2.text);
Label1.Caption:= FloatToStr(N1);
end;
end.

Aqui uso esa funcion porque es la unica que me permitia sumar dos numeros del tipo 00,000,000.00 Gracias
Responder Con Cita