aqConvert.CurrencyToFormatStr Method

Applies to TestComplete 15.70, last modified on December 17, 2024

Description

The CurrencyToFormatStr method converts a currency value to a string. The format of the resulting string is defined by the iNumDigits, iLncLead, iUseParens and iGroup parameters.

Declaration

aqConvert.CurrencyToFormatStr(C, iNumDigits, iLncLead, iUseParens, iGroup)

C [in]    Required    Currency    
iNumDigits [in]    Required    Integer    
iLncLead [in]    Required    Integer    
iUseParens [in]    Required    Integer    
iGroup [in]    Required    Integer    
Result String

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

C

Specifies the currency value to be converted to a string.

iNumDigits

Specifies the number of digits after the decimal point. If the value has fewer digits after the point, trailing zeros are added. Set this parameter to -1 in order to use the default number of digits after the decimal point that is specific to the current locale.

iLncLead

Specifies whether to add leading digits to broken numbers. The acceptable values are 0 (false), -1 (true) and -2 (use a system value specific to the locale).

iUseParens

Specifies whether to hide the minus sign and enclose negative numbers in parenthesis. The acceptable values are 0 (false), -1 (true) and -2 (use a system value specific to the locale).

iGroup

Specifies whether to use thousand separators and group the resulting value by thousands. The acceptable values are 0 (false), -1 (true) and -2 (use a system value specific to the locale).

Result Value

The string containing the converted currency value.

Example

The code below converts a currency value to a string according to your local settings (the CurrencyToStr method) or according to your custom formatting settings (the CurrencyToFormatStr method).

JavaScript, JScript

function Converting()
{
  Log.Message(aqConvert.CurrencyToFormatStr(5642.25, 3, false, false, true));
}

/*
The routine produces the following output for the US English locale:

$5,642.250
*/

Python

def Converting():
  Log.Message(aqConvert.CurrencyToFormatStr(5642.25, 3, False, False, True))

# The routine produces the following output for the US English locale:
# $5,642.250

VBScript

sub Converting
  Log.Message(aqConvert.CurrencyToFormatStr(5642.25, 3, false, false, true))
end sub

' The routine produces the following output for the US English locale:

' $5,642.250

DelphiScript

procedure Converting;
begin 
  Log.Message(aqConvert.CurrencyToFormatStr(5642.25, 3, false, false, true));
end;

{
The routine produces the following output for the US English locale:

$5,642.250
}

C++Script, C#Script

function Converting()
{
  Log["Message"](aqConvert["CurrencyToFormatStr"](5642.25, 3, false, false, true));
}

/*
The routine produces the following output for the US English locale:

$5,642.250
*/

See Also

Working With Numeric Values
CurrencyToStr Method
StrToCurrency Method

Highlight search results