HRESULT VarParseNumFromStr(
[in] OLECHAR* strIn,
[in] LCID lcid,
[in] unsigned long dwFlags,
[in] NUMPARSE *pnumprs,
[out] unsigned char *rgbDig
);
Parses a string, and creates a type-independent description of the number it represents.
The VarParseNumFromStr function fills in the dwOutFlags element with each corresponding feature that was actually found in the string. This allows the caller to make decisions about what numeric type to use for the number, based on the format in which it was entered. For example, one application might want to use the CURRENCY data type if the currency symbol is used, and others may want to force a floating point type if an exponent was used.
The return value obtained from the returned HRESULT is one of the following.
Return value | Meaning |
---|---|
S_OK | Success. |
E_OUTOFMEMORY | Internal memory allocation failed. (Used for DBCS only to create a copy with all wide characters mapped narrow.) |
DISP_E_TYPEMISMATCH | There is no valid number in the string, or there is no closing parenthesis to match an opening one. In the former case, cDig and cchUsed in the NUMPARSE structure will be zero. In the latter, the NUMPARSE structure and digit array are fully updated, as if the closing parenthesis was present. |
DISP_E_OVERFLOW | For hexadecimal and octal digits, there are more digits than will fit into the array. For decimal, the exponent exceeds the maximum possible. In both cases, the NUMPARSE structure and digit array are fully updated (for decimal, the cchUsed field excludes the entire exponent). |