[Lazarus] Stupid pascal question

Damien Gerard milipili at shikami.org
Fri Feb 29 20:45:06 CET 2008


Le Feb 29, 2008 à 8:23 PM, Dalton Calford a écrit :

> I have been reading and searching all the various bits of  
> documentation
> I can find but I can not discover a method of converting an ansistring
> to a real.
>
> I was hoping for a function like Str2Real() or StrToReal() but I am
> having no luck.
>
> I am using the latest stable version of lazarus and fpc.
>
> Anyone know what unit I should include and where I can find any
> documentation for this?
>

May be you are looking for these functions :

Function StrToFloat(Const S : String) : Extended;
Function StrToFloat(Const S : String; Const FormatSettings:  
TFormatSettings) : Extended;
Function StrToFloatDef(Const S: String; Const Default: Extended):  
Extended;
Function StrToFloatDef(Const S: String; Const Default: Extended; Const  
FormatSettings: TFormatSettings): Extended;
Function TryStrToFloat(Const S : String; Var Value: Single): Boolean;
Function TryStrToFloat(Const S : String; Var Value: Single; Const  
FormatSettings: TFormatSettings): Boolean;
Function TryStrToFloat(Const S : String; Var Value: Double): Boolean;
Function TryStrToFloat(Const S : String; Var Value: Double; Const  
FormatSettings: TFormatSettings): Boolean;

Function CurrToStr(Value: Currency): string;
function StrToCurr(const S: string): Currency;
function TryStrToCurr(const S: string;Var Value : Currency): Boolean;
function StrToCurrDef(const S: string; Default : Currency): Currency;

(uses SysUtils but not sure)

> best regards
>
> Dalton
>
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus



--
Damien Gerard
milipili at shikami.org

Le temps n'a pas d'importance. Seul le code est important
    -- (f00ty)








More information about the Lazarus mailing list