Applies to TestComplete 14.60, last modified on September 18, 2020

Description

The CurrencyToStr method converts a currency value to a string. The resultant string holds up to 15 digits. Trailing zeros are removed and the decimal point appears only if it is necessary. The resulting value is formatted according to the current local settings. To apply custom formatting, use the CurrencyToFormatStr method.

Declaration

aqConvert.CurrencyToStr(C)

C [in]    Required    Currency    
Result String

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

C

Specifies the currency value to be converted to a string.

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.CurrencyToStr(5642.25));
  Log.Message(aqConvert.CurrencyToFormatStr(5642.25, 3, false, false, true));
}

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

$5,642.25
$5,642.250
*/

Python

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

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

VBScript

sub Converting
  Log.Message(aqConvert.CurrencyToStr(5642.25))
  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.25
' $5,642.250

DelphiScript

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

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

$5,642.25
$5,642.250
}

C++Script, C#Script

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

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

$5,642.25
$5,642.250
*/

See Also

Working With Numeric Values
CurrencyToFormatStr Method
StrToCurrency Method

Highlight search results