[求助]如何去掉字符串中重复的值?
如何去掉字符串中重复的值?
private void button1_Click(object sender, EventArgs e)
{
string temp = textBox1.Text.Trim();
string tempstr="";
for (int i = 0; i <=temp.Length-1; i++)
{
tempstr=temp.Substring(i,1);
if (temp.IndexOf(tempstr)!=i)
{
temp = temp.Remove(i,1);
i = 0;
}
}
this.textBox2.Text = temp;
}
[此贴子已经被作者于2007-7-10 10:14:56编辑过]