Send feedback on this topic.
Teradata.Client.Provider
Culture Specific Format of Numeric String
.NET Data Provider for Teradata > Developer's Guide > Data Types > Numeric Data Types > Culture Specific Format of Numeric String

When a numeric string is converted to a Numeric Provider Specific Type, the format of the numeric string can be controlled by the System.Globalization.NumberFormatInfo class. This class is used to control the cultural aspects of a numeric string.  For example, the symbols for the decimal and group separators can be changed to match the corresponding symbols of a specific culture.

The format of a numeric string can be controlled when one of the following overloaded methods. These methods have been implemented by all the Numeric Provider Specific Types:

If a format provider is not specified, the default culture will be used.

There are limitations on the cultural specific formats that can be parsed by TdDecimal.Parse. Please refer to the section Parsing Numeric Strings for more information.

Example

The following is an example of specifying the format of a numeric string.

C#
Copy Code
using System.Globalization;

public void StringExample( ) 
{ 
     //number = 3246098.785736
    TdDecimal value = new TdDecimal(0x1A90A5C8, 0x000002F3, 0, 0, 13, 6); 

    NumberFormatInfo formatInfo = new NumberFormatInfo();
    formatInfo.NumberDecimalSeparator = " DecimalPoint ";

    // The resulting decimalString will be  "3246098 DecimalPoint 785736".
    String decimalString = value.ToString("F", formatInfo);

    // Getting the default NumberFormatInfo
    NumberFormatInfo currentInfo = NumberFormatInfo.CurrentInfo;

    // The resulting decimalString will be  "3246098.785736".
    decimalString = value.ToString(null, currentInfo);

    // Getting the default NumberFormatInfo is the same as calling ToString()
    decimalString = value.ToString();    
}