protected string merge(string[] stringArr)
{
string returnString = string.Empty;
foreach (string s in stringArr)
{
returnString += s + ",";
}
returnString = returnString.Substring(0, returnString.Length - 1);
returnString = returnString.Replace(",,", ",");
string[] strArr = returnString.Split(',');
ArrayList arrList = new ArrayList();
arrList.Add(strArr[0]);
if (strArr.Length > 1)
{
for (int i = 1; i < strArr.Length - 1; i++)
{
if (!arrList.Contains(strArr[i]))
{
arrList.Add(strArr[i]);
}
}
}
returnString = string.Empty;
for (int i = 0; i < arrList.Count; i++)
{
returnString += arrList[i] + ",";
}
returnString = returnString.Substring(0, returnString.Length - 1);
return returnString;
} |