What's a C# regular expression that'll validate currency, float or integer?

前端 未结 8 2401
闹比i
闹比i 2020-12-06 12:21

What is a regular expression suitable for C# that\'ll validate a number if it matches the following?

 $1,000,000.150
 $10000000.199
 $10000 
 1,         


        
8条回答
  •  不思量自难忘°
    2020-12-06 13:14

    Be careful with floats. Eventually you will hit a case such as 0.01 represented as 0.00999999. Strings or integers are better to use.

提交回复
热议问题