Mega Code Archive

 
Categories / Delphi / Examples
 

Dot versus comma in string representation of a float

Question: Normally FloatToStr gives local decimal separator. (From System settings) How can I convert a float to a string with decimal dot and no separators? Answer: Use the Str() function instead of FloatToStr(), e.g. var fMyFload : float; sMyString : string; begin Str(fMyFloat:10:5, sMyString); end;