Output Digit Substitution for number format in CSharp

Description

The following code shows how to output Digit Substitution for number format.

Example


using System;/*from   w w w .  ja  v a  2 s.  c om*/
using System.Globalization;

class Sample 
{
    public static void Main() 
    {
            CultureInfo westernCI = new CultureInfo("en-US");
            CultureInfo arabicCI  = new CultureInfo("ar-SA");
            CultureInfo thaiCI    = new CultureInfo("th-TH");
            DigitShapes shape;
            string name;
            string intro = "{0} {1}.";
        
            name  = westernCI.EnglishName;
            shape = westernCI.NumberFormat.DigitSubstitution;
            Console.WriteLine(intro, name, shape);
        
            name  = arabicCI.EnglishName;
            shape = arabicCI.NumberFormat.DigitSubstitution;
            Console.WriteLine(intro, name, shape);
        
            name  = thaiCI.EnglishName;
            shape = thaiCI.NumberFormat.DigitSubstitution;
            Console.WriteLine(intro, name, shape);
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var