Einzelnen Beitrag anzeigen

rwalper

Registriert seit: 6. Sep 2006
45 Beiträge
 
Delphi 11 Alexandria
 
#3

AW: Zahl aus Datei einlesen , Format passt nicht

  Alt 18. Jun 2015, 15:21
Eine Möglichkeit wäre, die globale Variable FormatSettings.DecimalSeparator zur Konvertierung umzusetzen:
Delphi-Quellcode:
  
  ch := FormatSettings.DecimalSeparator;
  FormatSettings.DecimalSeparator := '.';
  try
    f := StrToFloat(s);
  finally
    FormatSettings.DecimalSeparator := ch;
  end;
Wobei ich Folgendes bevorzuge:
Delphi-Quellcode:
  
  s := StringReplace(s, '.', FormatSettings.DecimalSeparator, []);
  f := StrToFloat(s);
  Mit Zitat antworten Zitat