转成百分比

public static string GetNumericFormat(double value, int digit = 2, int percent = 1)
{
System.Globalization.NumberFormatInfo provider = new System.Globalization.NumberFormatInfo();
provider.PercentDecimalDigits = digit;//小数点保留几位数. 
provider.PercentPositivePattern = percent;//百分号出现在何处. 
return value.ToString("P", provider);
}

 

posted @ 2020-06-04 23:13  八英里  阅读(180)  评论(0编辑  收藏  举报