C#中处理货币中带有逗号的情况

javascript:

Remove all non dot / digits:

var currency ="$1,100.00";



var number =Number(currency.replace(/[^0-9\.]+/g,""));

 

 

C#:

CultureInfo culture = CultureInfo.GetCultureInfo(IocServiceFactory.Resolve<IStateStorage>().UserFormatLanguage);

double result = 0.0;

bool success = double.TryParse(Request[Value], NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign | NumberStyles.AllowParentheses | NumberStyles.AllowThousands | NumberStyles.AllowTrailingSign,culture, out result);

if (success)

{

info.Value = result;

}

你可能感兴趣的:(C#)