Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Ayuda con TFormatSettings (https://www.clubdelphi.com/foros/showthread.php?t=56165)

Faust 08-05-2008 23:55:15

Ayuda con TFormatSettings
 
Saludos camaradas, he estado checando que esto tal vez me pueda servir en la función StrToFloat, pero no sé como usar esta estructura, alguien podría ayudarme un poco con esto e implementar un ejemplo...

Desde ya muchas gracias

BlueSteel 09-05-2008 00:46:54

Cita:

Empezado por Faust (Mensaje 285411)
Saludos camaradas, he estado checando que esto tal vez me pueda servir en la función StrToFloat, pero no sé como usar esta estructura, alguien podría ayudarme un poco con esto e implementar un ejemplo...

Desde ya muchas gracias


Hola Faust...

la función StrToFloat lo que hace es poder convertir una cadena de texto (String) al tipo de dato Float.... lo mismo puedes hacer con StrToInt o StrToDate... o a la inversa como FloatToStr, IntToStr, DateToStr...

Eje..

Código Delphi [-]
 
vEntero : Integer;
vReal    : Double;
vFecha  : String;
 
vEntero := 10;
vReal    := 10,25;  // Utilizo coma como separador decimal
vFecha := '08/05/2008';
 
 
// Prueba 1
 
Label1.Caption := IntToStr(vEntero);
Label2.Caption := FloatToStr(vReal);
DateTimePicker.Date := StrToDate(vFecha);
 
//o tambien puede ser algo así..
 
vEntero := StrToInt(Label1.Caption);
vReal := StrToFloat(Label2.Caption);
vFecha := DateToStr(DateTomePicker.Date);

Salu2:p:D

Faust 09-05-2008 20:08:39

Si amigo BlueSteel, esto me queda claro , pero como utilizar la estructura TFormatSettigs en conjunto con la función FloatToStrF, definida así:

Código Delphi [-]
Delphi syntax:

function FloatToStrF(Value: Extended; Format: TFloatFormat; Precision, Digits: Integer): string; overload;
function FloatToStrF(Value: Extended; Format: TFloatFormat; Precision, Digits: Integer; const FormatSettings: TFormatSettings): string; overload;

Faust 13-05-2008 01:10:05

Aquí reviviendo este hilo

freddiaz07 06-06-2008 21:16:21

Estructura TFormatSettigs
 
Hola Amigo La Estructura

Editx.Text := FloatToStrF((StrtoFloat(Editx.Text)),ffnumber,10,2);


Revisa este Link tiene mas Informacion

http://delphiallimite.blogspot.com/2...riable_21.html


La franja horaria es GMT +2. Ahora son las 03:03:49.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi