美文网首页
数组查重的方法

数组查重的方法

作者: 2c4419e9dafa | 来源:发表于2018-08-02 17:39 被阅读0次
    public function CheckRepeatClass():String
    {
        var repeatClass:String = "";
        var strClass:String = "";
                
        if (m_aryData && m_aryData.length > 0)
        {
            for (var i:int = 0; i < m_aryData.length; i++)
            {
                if (strClass.indexOf(m_aryData[i].classification) > -1)
                {
                    repeatClass += ";“" + m_aryData[i].classification + "”";
                }
                else
                {
                    if (0 == i)
                    {
                        strClass += m_aryData[i].classification;
                    }
                    else
                    {
                        strClass += ";" + m_aryData[i].classification;
                    }
                }
            }
                    
            if ("" != repeatClass)
            {
                repeatClass = repeatClass.substring(1);
            }
        }
                
        return repeatClass;
    }
    

    相关文章

      网友评论

          本文标题:数组查重的方法

          本文链接:https://www.haomeiwen.com/subject/hqusvftx.html