整理和重新建立关键词 - KeyWordRebuild
2017-02-05 10:38:32 访问(1662) 赞(0) 踩(0)
/// <summary>
/// 整理和重新建立关键词
/// </summary>
/// <param name="sortName"></param>
/// <param name="str"></param>
/// <returns></returns>
public static string KeyWordRebuild
(
string sortName,
string str
)
{
if (sortName == null)
sortName = "";
else
sortName = sortName.Trim();
if (str == null || str.Length == 0)
return sortName;
str = sortName + "," + str.Replace(",", ",");
string[] sA = str.Split(',');
List<string> sL = new List<string>();
StringBuilder theResult = new StringBuilder();
bool isFirst = true;
string strTmp = null;
string strLowerTmp = null;
foreach (string s in sA)
{
if (s == null || s.Length == 0)
continue;
strTmp = s.Trim();
if (strTmp.Length == 0)
continue;
strLowerTmp = strTmp.ToLower();
if (sL.Contains(strLowerTmp))
{
continue;
}
sL.Add(strLowerTmp);
if (isFirst)
isFirst = false;
else
theResult.Append(",");
theResult.Append(strTmp);
}
return theResult.ToString();
}
标签:
整理和重新建立关键词 - KeyWordRebuild 


上一条:
下一条:
相关评论
发表评论