CCur Function in QTP

What is CCur Function :
Returns an expression that has been converted to a Variant of subtype Currency.
CCur(expression)
The expression argument is any valid expression.

Remarks

In general, you can document your code using the subtype conversion functions to show that the result of some operation should be expressed as a particular data type rather than the default data type. For example, use CCur to force currency arithmetic in cases where integer arithmetic normally would occur.
You should use the CCur function to provide internationally aware conversions from any other data type to a Currency subtype. For example, different decimal separators and thousands separators are properly recognized depending on the locale setting of your system.
The following example uses the CCur function to convert an expression to a Currency:
Dim MyDouble, MyCurr MyDouble = 543.214588 
' MyDouble is a Double. MyCurr = CCur(MyDouble * 2) 
' Convert result of MyDouble * 2 (1086.429176) to a Currency (1086.4292)
 
Some more relevant posts covering the VBScript functions and other Vbscript used for coding in QTP.:



 

Post a Comment

Previous Post Next Post