敷面膜在C#asp.net一个字符串? [英] Apply mask a string in C# asp.net?
问题描述
大家好我的项目,我想货币三种格式。
Hi all in my project i want a currency in three formats,.
1) ...999,999,999
2) ...999,999,999.00
3) ...999,999,99
该格式在MySQL数据表的字段中指定。我的项目是在ASP.NET,所以我不能用MaskedTextBox中。 code我尝试:
The format is specified in mysql data table field. My project is in ASP.NET so I can't use MaskedTextBox . Code I tried:
String.Format("{999,999,999}",rate);
和
rate.ToString("999,999,999).
如何让面膜字符串?
How to get the mask string?
推荐答案
有关强制输入要在你指定的格式,使用AJAX控件工具包 MaskedEdit
控制。
For forcing an input to be in your specified format, use the AJAX Control Toolkit MaskedEdit
control.
有关输出数量在一个特定格式的字符串,看看下面的网页:
For outputting a number as a string in a specific format, look at the following pages:
- Standard Numeric Format Strings
- Custom Numeric Format Strings
可以创建一个字符串格式,并把它直接在的ToString
函数,或者创建一个特殊的的NumberFormatInfo
,与以下选项:
Either create a string format and put it directly in the ToString
function, or create a special NumberFormatInfo
, with the following options:
- CurrencyPositivePattern :定义正值的货币符号的位置
- CurrencyNegativePattern :定义为负值的货币符号的位置,并指定负号是否重新用括号或NegativeSign财产psented $ P $
- NegativeSign :定义使用的负号,如果CurrencyNegativePattern表明,括号不使用
- CURRENCYSYMBOL :定义货币符号
- CurrencyDecimalDigits :定义货币值的小数位数的默认号码。这个值可以通过使用precision说明所覆盖。
- CurrencyDecimalSeparator :定义分隔整数和小数位数字符串
- CurrencyGroupSeparator :定义分隔整数号码组字符串
- CurrencyGroupSizes :定义中出现了一批在整数位的数量
- CurrencyPositivePattern: Defines the placement of the currency symbol for positive values.
- CurrencyNegativePattern: Defines the placement of the currency symbol for negative values, and specifies whether the negative sign is represented by parentheses or the NegativeSign property.
- NegativeSign: Defines the negative sign used if CurrencyNegativePattern indicates that parentheses are not used.
- CurrencySymbol: Defines the currency symbol.
- CurrencyDecimalDigits: Defines the default number of decimal digits in a currency value. This value can be overridden by using the precision specifier.
- CurrencyDecimalSeparator: Defines the string that separates integral and decimal digits.
- CurrencyGroupSeparator: Defines the string that separates groups of integral numbers.
- CurrencyGroupSizes: Defines the number of integer digits that appear in a group.
这篇关于敷面膜在C#asp.net一个字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!