如果您想要删除所有空格, 而不是 words[ i] = words[ i].Trim( rr); code>, 您可以使用 :
words[i] = words[i].Replace(" ", string.Empty);
就我个人而言,为了你第一次被除名(0),我也会这样做:
words[i] = words[i].Replace("0", string.Empty); // Remove all "0" characters
words[i] = words[i].Replace(" ", string.Empty); // Remove all spaces
或者,甚至:
words[i] = words[i].Replace("0", string.Empty).Replace(" ", string.Empty);