Friday, September 14, 2012

Decimal Precision Using Regex in asp.net

public static string AdjustDecimalPrecision(decimal value)
{
            return new Regex("\\d+(\\.\\d{1,2})?"). Match(value.ToString()).ToString();  
   
}

Namespace for Regex
using System.Text.RegularExpressions;

No comments:

Post a Comment

Comments

Search

Custom Search
Protected by Copyscape Plagiarism Software