DataFunctions.ConvertNumberString
Use this method to convert an integer represented as a string to an integer Variant, based on the default or specified locale.
Definition
Function ConvertNumberString(vtNum As Variant,vtLocale As Variant) As Variant
Parameters
vtNum
A Variant that contains a string representation of the number to convert.
vtLocale
A Variant that specifies the locale to use to convert the string. If this parameter is not specified, the value of the Locale property of the DataFunctions object is used.
Return Values
If this method completes successfully, it returns an integer Variant containing the converted number; otherwise, NULL is returned.
Error Values
This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to standard COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.
Remarks
The ConvertNumberString method is designed to accept only integers. Passing a floating-point number as the vtNum parameter results in an error. To convert floating-point numbers, use the ConvertFloatString method.
For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.
Example
<HTML>
<HEAD>
</HEAD>
<BODY>
<%
' Converts integer string using US and France locales
' vSourceInt is a variant containing an integer string
Dim Result
Set MSCSDataFunctions = Server.CreateObject("Commerce.DataFunctions")
myLocale = "1036"
MSCSDataFunctions.Locale = myLocale
Result = MSCSDataFunctions.ConvertNumberString(vSourceInt , _
myLocale)
Response.Write "France: " & Result & "<P>"
myLocale = "1033"
MSCSDataFunctions.Locale = myLocale
Result = MSCSDataFunctions.ConvertNumberString(vSourceInt , _
myLocale)
Response.Write "USA: " & Result
%>
</BODY>
</HTML>