C#判断字符串数组中是否有重复项

 

bool hasRepeat(string[] strs)
{
    for (int i = 1; i < strs.Length; i++)
        for (int j = 0; j < i; j++)
        {
            if (strs[j] == strs[i])
                return true;
        }
    return false;
}

 

posted @ 2014-11-25 16:09  IT浪潮之巅  阅读(3131)  评论(0)    收藏  举报
   友情链接: 淘宝优惠券