Einzelnen Beitrag anzeigen

manfred_h

Registriert seit: 4. Nov 2005
Ort: Basel
442 Beiträge
 
Delphi XE2 Enterprise
 
#2

Re: Import aus Access >> ThousandSeparator

  Alt 20. Nov 2006, 15:01
Hallo nochmals

bin leider noch nicht weitergekommen
hier noch ein paar Info's:

In Access ist das feld als Text definiert.
In Firefox ist es als DECIMAL(18,2) definiert.

habe schon Stunden mit Google gesucht und unteranderem Diesen Code gefunden:

Delphi-Quellcode:
function TextToNumber(const Input: string): Extended;
{Remove all thousands separators from Input string and convert to a floating
point number}

var
  Num: string;
begin
  Result := 0;
  Num := Input;
  if Num = 'then Exit;
  while Pos(ThousandSeparator, Num) > 0 do
   Delete(Num, Pos(ThousandSeparator, Num), 1);
  try
   Result := StrToFloat(Num);
  except
   MessageDlg('Could not convert ' + Input + ' to a valid number.', mtError,
     [mbOK], 0);
  end;
end;
You can use it like this:
StrToFloat(TextToNumber('1,234.56'));

To format a floating point number to a string with thousands separators, use
FormatFloat or FloatToStrF. Example:
FormatFloat('#,##0.00', 1234.56);

aber irgendwie komme ich nicht weiter.
Kann mir jemand einen Ratschlag geben.

Shalom
Manfred
  Mit Zitat antworten Zitat