NumberFormatInfo recognizes "pos" as the positive sign and "neg" as the negative sign. : NumberFormatInfo « I18N Internationalization « C# / CSharp Tutorial






using System;
using System.Globalization;

public class Example
{
   public static void Main()
   {
      NumberFormatInfo provider = new NumberFormatInfo();
      provider.PositiveSign = "pos ";
      provider.NegativeSign = "neg ";

      string[] values= { "pos 34567", "neg 34567"};         

      foreach (string value in values)
      {
         try {
            Console.WriteLine("{0,17}", Convert.ToUInt16(value, provider));
         }
         catch (FormatException e) {       
            Console.WriteLine("{0,17}", e.GetType().Name);
         }     
      }
   }
}








21.5.NumberFormatInfo
21.5.1.NumberFormatInfo recognizes "pos" as the positive sign and "neg" as the negative sign.