去除字符串中相邻的相同的字符串,如:abcddddffff  返回:abcdf。

我写的解决方法如下,不知道大家还有什么好的方法否。
[算法]去除字符串中相邻的相同的字符串string strInputData = this.textBox1.Text.Trim();
[算法]去除字符串中相邻的相同的字符串            
char[] chars = strInputData.ToCharArray();
[算法]去除字符串中相邻的相同的字符串            
string strOutputData="";
[算法]去除字符串中相邻的相同的字符串            
int iLength = chars.Length;
[算法]去除字符串中相邻的相同的字符串            
for(int i=0;i < iLength - 1;i++)
            MessageBox.Show(strOutputData);

相关文章: