FormatCurr - C++ Builder

C++ Builder 参考手册 ➙ System::Sysutils ➙ FormatCurr


格式化货币类型数值,把货币类型数值按照参数给定格式转成字符串

头文件:#include
命名空间:System::Sysutils
函数原型:

System::UnicodeString __fastcall FormatCurr(const System::UnicodeString Format, System::Currency Value);
System::UnicodeString __fastcall FormatCurr(const System::UnicodeString Format, System::Currency Value, const TFormatSettings &AFormatSettings);

参数:

  • Value:货币类型数值;
  • Format:格式字符串,与 FormatFloat 函数的格式相同;
  • AFormatSettings:地区格式,详细描述请参考 FloatToStrF;

返回值:

  • 把参数 Value 的值按照参数 Format 的格式转为字符串,与 FormatFloat 函数的格式相同;
  • 地区格式:这个函数使用了地区格式的 DecimalSeparator 成员作为小数点、ThousandSeparator 成员作为千位分隔符,不同的地区可能会使用不同的字符当做小数点和千位分隔符,中国和大多数国家一样使用小圆点作为小数点、逗号作为千位分隔符,但是有的国家 - 例如法国:使用逗号当做小数点、空格当做千位分隔符,如果程序在法国和越南等国家的电脑上运行,默认情况所有的小数点都会使用逗号的,包括浮点数和货币型,程序国际化时要特别注意;
  • 如果有 AFormatSettings 参数,使用这个参数的格式;
  • 如果没有 AFormatSettings 参数,使用 全局变量 System::Sysutils::FormatSettings 作为地区格式;
  • AFormatSettings 或 System::Sysutils::FormatSettings 的例子请参考 FloatToStrF
  • 没有 AFormatSettings 参数的函数不是线程安全的,因为使用了全局变量作为默认的地区格式;带有 AFormatSettings 参数的函数是线程安全的。

相关:

  • System::Sysutils::FloatToStr
  • System::Sysutils::FloatToStrF
  • System::Sysutils::FloatToText
  • System::Sysutils::FloatToTextFmt
  • System::Sysutils::FloatToDecimal
  • System::Sysutils::FloatToCurr
  • System::Sysutils::TryFloatToCurr
  • System::Sysutils::TextToFloat
  • System::Sysutils::StrToFloat
  • System::Sysutils::StrToFloatDef
  • System::Sysutils::TryStrToFloat
  • System::Sysutils::StrToCurr
  • System::Sysutils::StrToCurrDef
  • System::Sysutils::TryStrToCurr
  • System::Sysutils::CurrToStr
  • System::Sysutils::CurrToStrF
  • System::Sysutils::FormatFloat
  • System::Sysutils::FormatCurr
  • System::Sysutils::TFloatRec
  • System::Sysutils::TFloatValue
  • System::Sysutils::FormatSettings
  • System::Sysutils::TFormatSettings
  • System::Sysutils::StrToBool
  • System::Sysutils::StrToBoolDef
  • System::Sysutils::TryStrToBool
  • System::Sysutils::BoolToStr
  • System::Sysutils::DateTimeToStr
  • System::Sysutils::DateTimeToString
  • System::Sysutils::DateToStr
  • System::Sysutils::GUIDToString
  • System::Sysutils::IntToStr
  • System::Sysutils::IntToHex
  • System::Sysutils::TimeToStr
  • System::Sysutils::UIntToStr
  • System::Sysutils
  • System::Currency
  • System
  • std::itoa, std::_itoa, std::_itot, std::_itow
  • std::ltoa, std::_ltoa, std::_ltot, std::_ltow
  • std::ultoa, std::_ultoa, std::_ultot, std::_ultow
  • std::_i64toa, std::_i64tot, std::_i64tow
  • std::_ui64toa, std::_ui64tot, std::_ui64tow
  • std::ecvt, std::_ecvt
  • std::fcvt, std::_fcvt
  • std::gcvt, std::_gcvt

C++ Builder 参考手册 ➙ System::Sysutils ➙ FormatCurr
`

你可能感兴趣的:(FormatCurr - C++ Builder)