首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

trim方法有关问题

2011-12-29 
trim方法问题我要获取dataGridView1.Rows[0].Cells[1].Value.ToString()的值可是这个里面有空格,如何去掉

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);

热点排行