Mega Code Archive

 
Categories / Delphi / Forms
 

How to format a currency according to the specified locales settings

Title: How to format a currency according to the specified locales settings function GetCurrency(number: PChar): string; var tmpStr: string; begin SetLength(tmpStr, 255); GetCurrencyFormat(LOCALE_SYSTEM_DEFAULT, 0, number, nil, PChar(tmpStr), Length(tmpStr)); Result := tmpStr; end; Usage Example: procedure TForm1.Button1Click(Sender: TObject); begin Application.MessageBox(PChar(GetCurrency(PChar(Edit1.Text))), '', MB_OK); end;