输入测试用例:
1000 .12
1,000.12
1.000.12
1,000,12
1000,...,12
输出: 1000,12
答案 0 :(得分:-2)
试试这个
string[] inputs = { "1000.12", "1,000.12", "1.000.12", "1,000,12", "1000,,12", "1000.12" };
for (int i = 0; i < inputs.Count(); i++)
{
inputs[i] = inputs[i].Replace(".", "");
inputs[i] = inputs[i].Replace(",", "");
string output = inputs[i].Substring(0, inputs[i].Length - 2) + "," + inputs[i].Substring(inputs[i].Length - 1);
Console.WriteLine(output);
}
Console.ReadLine();