SysUtils和System.SysUtils中的DecimalSeparator

Lin*_*ues 12 delphi components vcl

我需要找到DecimalSeparator var SysUtils Delphi 7,在Delphi XE6中我试图在System.SysUtils中找到,但没有成功.有人可以告诉我在Delphi XE6中哪里可以找到她吗?

在Delphi 7中,它位于第618行的SysUtils.pas单元中:

var 
   CurrencyString: string; 
   CurrencyFormat: Byte; 
   NegCurrFormat: Byte; 
   ThousandSeparator: Char; 
   DecimalSeparator: Char;
Run Code Online (Sandbox Code Playgroud)

我需要这个变量来将Delphi 7的一个组件转换为XE6

Lin*_*ues 20

我的不好,首先我需要调用FormatSettings,然后我可以在Delphi XE6的DecimalSeparator中使用,

FormatSettings.DecimalSeparator

  • 全局格式变量在XE中已弃用,最终[在XE6中删除](http://docwiki.embarcadero.com/RADStudio/XE6/en/Global_Variables). (4认同)

Rod*_*ima 7

procedure ConfigureBrazilRegion;
var
  FormatBr: TFormatSettings;
begin
  // Create new setting and configure for the brazillian format
  FormatBr                     := TFormatSettings.Create;
  FormatBr.DecimalSeparator    := ',';
  FormatBr.ThousandSeparator   := '.';
  FormatBr.CurrencyDecimals    := 2;
  FormatBr.DateSeparator       := '/';
  FormatBr.ShortDateFormat     := 'dd/mm/yyyy';
  FormatBr.LongDateFormat      := 'dd/mm/yyyy';
  FormatBr.TimeSeparator       := ':';
  FormatBr.TimeAMString        := 'AM';
  FormatBr.TimePMString        := 'PM';
  FormatBr.ShortTimeFormat     := 'hh:nn';
  FormatBr.LongTimeFormat      := 'hh:nn:ss';
  FormatBr.CurrencyString      := 'R$';

  // Assign the App region settings to the newly created format
  System.SysUtils.FormatSettings := WFormatBr;
end;
Run Code Online (Sandbox Code Playgroud)

  • @ user30478描述是问题,如果你还有任何疑问,请先阅读并评论. (3认同)