ArcObjects Library Reference (PublisherControls)  

IARUnitConverter.DoubleAsString Method

Converts the specified value to a string rounded to a specified number of decimal places.

[Visual Basic .NET]
Public Function DoubleAsString ( _
    ByVal dValue As Double, _
    ByVal nDigits As Integer, _
    ByVal bSeparators As Boolean _
) As String
[C#]
public string DoubleAsString (
    double dValue,
    int nDigits,
    bool bSeparators
);

Product Availability

Available with ArcGIS Desktop. Requires Publisher Extension.

Description

Converts the specified value to a string, rounded to the specified number of decimal places. Specify whether the string is to contain separators. The separators are determined by the machines regional settings; typically a comma "," for separating groups of digits and a full stop "." to separate the decimal part. In many countries a comma is conventionally used as a decimal point.

[C#]
IARUnitConverter unitConverter = axArcReaderControl1.ARUnitConverter;
string s;
//Returns 1000.66
s = unitConverter.DoubleAsString(1000.66, 2, false);
//Returns 1,000.66
s = unitConverter.DoubleAsString(1000.66, 2, true);
//Returns 1000.7
s = unitConverter.DoubleAsString(1000.66, 1, false);
//Returns 1001 
s = unitConverter.DoubleAsString(1000.66, 0, false);
//Returns 1,000.6600
s = unitConverter.DoubleAsString(1000.66, 4, true);
[Visual Basic .NET]
Dim pUnitConverter As IARUnitConverter
pUnitConverter = AxArcReaderControl1.ARUnitConverter
Dim s As String
'Returns 1000.66
s = pUnitConverter.DoubleAsString(1000.66, 2, False)
'Returns 1,000.66
s = pUnitConverter.DoubleAsString(1000.66, 2, True)
'Returns 1000.7
s = pUnitConverter.DoubleAsString(1000.66, 1, False)
'Returns 1001 
s = pUnitConverter.DoubleAsString(1000.66, 0, False)
'Returns 1,000.6600
s = pUnitConverter.DoubleAsString(1000.66, 4, True)

See Also

IARUnitConverter Interface