System.SysUtils.StrToCurrDef

From Appmethod Libraries
Jump to: navigation, search

Object Pascal

function StrToCurrDef(const S: string; const Default: Currency): Currency;
function StrToCurrDef(const S: string; const Default: Currency; const AFormatSettings: TFormatSettings): Currency;

C++

extern DELPHI_PACKAGE System::Currency __fastcall StrToCurrDef(const System::UnicodeString S, const System::Currency Default)/* overload */;

Properties

Type Visibility Source Unit Parent
function public
System.SysUtils.pas
System.SysUtils.hpp
System.SysUtils System.SysUtils

Description

Converts a string to a Currency value, with default error.

Call StrToCurrDef to convert a string that represents a floating-point value to the corresponding Currency value. The source string, S, must consist of an optional sign (+ or -), a string of digits with an optional decimal point, and an optional 'E' or 'e' followed by a signed integer. Leading and trailing blanks are ignored.

Thousand separators and currency symbols are not allowed in the string. If the string doesn't contain a valid value, StrToCurrDef returns Default.

The first form of StrToCurrDef is not thread-safe, because it uses localization information contained in global variables. The second form of StrToCurrDef, which is thread-safe, refers to localization information contained in the AFormatSettings parameter. Before calling the thread-safe form of StrToCurrDef, you must populate AFormatSettings with localization information. To populate AFormatSettings with a set of default locale values, call TFormatSettings.Create.

See Also