WP应用开发有关问题,无法replace textbox中的字符串

我想使用string.replace替换字符串中的某一个字,当我将textbox的值传入时总是不能正确替换。

我使用

  if (double.TryParse(originalAmount.Replace('¥', ' '), out billAmount))
            {
                tipAmount = billAmount * tipPercentage;
                totalAmount = billAmount + tipAmount;
            }

将originalAmount中的¥转换为空格,originalAmount为TextBox.Text,传值传到上述类的方法中
我想知道为什么不行,如何才能几角这个问题

double解析的时候字符串不能有空格
originalAmount.Replace("¥", string.Empty)
这样看看

不行,第二个参数不能为string,而且我是想把¥转换成空格

我按照你的方法试了一下,是没问题的。你看一下是不是你 '¥' 这个符号打错了。