I have some forms in which users will input some numbers, I want to prevent them from entering more than one comma in this string
I made something like this
var input = "1,,,,2";
var value = Regex.Replace(input, ",{1,}", ".");
This will output 1.2, which is correct. But if I enter
var input = 1,,,2,3,,,4,5,,6
everything fails
What id like to do is to form the last version of the input to 1.23456
Any advice?
Thanks
This replaces the first
,comma with a.period, then replaces the remaining commas withempty.