Windows Dev Center

VarFormatNumber function

Formats a variant containing numbers into a string form.

Syntax


HRESULT VarFormatNumber(
  _In_  LPVARIANT pvarIn,
  _In_  int       iNumDig,
  _In_  int       iIncLead,
  _In_  int       iUseParens,
  _In_  int       iGroup,
  _In_  ULONG     dwFlags,
  _Out_ BSTR      *pbstrOut
);

Parameters

pvarIn [in]

The variant containing the value to format.

iNumDig [in]

The number of digits to pad to after the decimal point. Specify -1 to use the system default value.

iIncLead [in]

Specifies whether to include the leading digit on numbers.

ValueMeaning
-2

Use the system default.

-1

Include the leading digit.

0

Do not include the leading digit.

 

iUseParens [in]

Specifies whether negative numbers should use parentheses.

ValueMeaning
-2

Use the system default.

-1

Use parentheses.

0

Do not use parentheses.

 

iGroup [in]

Specifies whether thousands should be grouped. For example 10,000 versus 10000.

Note  Regular numbers and currencies have separate system defaults for all the above options.
ValueMeaning
-2

Use the system default.

-1

Group thousands.

0

Do not group thousands.

 

dwFlags [in]

VAR_CALENDAR_HIJRI is the only flag that can be set.

pbstrOut [out]

Points to the formatted string that represents the variant.

Return value

This function can return one of these values.

Return codeDescription
S_OK

Success.

E_INVALIDARG

One or more of the arguments is not valid.

 

Remarks

This function uses the user's default locale while calling VarTokenizeFormatString and VarFormatFromTokens.

Windows Phone 8.1: This API is supported.

Requirements

Header

OleAuto.h

Library

OleAut32.lib

DLL

OleAut32.dll

See also

VarTokenizeFormatString
VarFormatFromTokens
Formatting Routines

 

 

Community Additions

ADD
Show:
© 2015 Microsoft