Monday, May 18, 2009

To Remove specfic string from Collection of string

///
/// To Remove specfic string from Collection of string
///

///
///
///
public static string mRemoveStringFromCollection(string strNames, string sep, string specificStr)
{
List list = new List();
string strValue = String.Empty;
if (!string.IsNullOrEmpty(strNames))
{
list.AddRange(Regex.Split(strNames, sep));
foreach (string str in list)
{
if (!str.Contains(specificStr))
{
if (string.IsNullOrEmpty(strValue))
{
strValue = str;
}
else
{
strValue = strValue + sep + str;
}
}
}

return strValue;
}
return strNames;
}

No comments:

Post a Comment

 
Locations of visitors to this page