NumberFormatInfo.CurrencyGroupSeparator : NumberFormatInfo « System.Globalization « C# / C Sharp by API






NumberFormatInfo.CurrencyGroupSeparator

  

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Text.RegularExpressions;
using System.Reflection;

public class MainClass{

   public static void Main(){
        string[] money = new string[] { "$0.99", "$0,99", "$1000000.00", "$10.25", "$90,000.00", "$90.000,00", "$1,000,000.00", "$1,000000.00" };
        NumberFormatInfo info = CultureInfo.CurrentCulture.NumberFormat;
        Regex moneyint = new Regex(String.Format(@"\{0}(\d{{1,3}}\{0})*\d+\{1}\d{{2}}",
            info.CurrencyGroupSeparator, info.CurrencyDecimalSeparator));

        foreach (string m in money)
        {
            Console.WriteLine("{0}: {1}", m, moneyint.IsMatch(m));
        }
   }
}

   
    
  








Related examples in the same category

1.new NumberFormatInfo()
2.NumberFormatInfo.CurrencySymbol
3.NumberFormatInfo.NumberDecimalSeparator
4.NumberFormatInfo.NumberGroupSeparator