日期:2014-05-20  浏览次数:20778 次

trim方法问题
我要获取
dataGridView1.Rows[0].Cells[1].Value.ToString()     的值

可是这个里面有空格,如何去掉这个空格

dataGridView1.Rows[0].Cells[1].Value.ToString.trim()
这样不行

我开始用这个
string   z;
z=dataGridView1.Rows[0].Cells[1].Value.ToString();
z.trim();

有没有别的办法?

------解决方案--------------------
Repleace( " ", " ");
------解决方案--------------------
dataGridView1.Rows[0].Cells[1].Value.ToString().Replace( " ",string.Empty);