好吧,不知道如何提出這個問題,但我試圖將值收集到數組中,但每個值都可能有重複(或附加)的字符串其餘的價值觀,我相信他們總是建立在彼此之上...Javascript/jQuery查找並刪除數組其餘值中的數組值
這是我的意思。
,如果我要輸出數組,這將是這樣的:
[0] => This is a string.
[1] => here's another string. This is a string.
[2] => And now there's a third string. here's another string. This is a string.
[3] => Here's a string that might not follow the pattern. This is a string.
我想什麼,最終輸出
[0] => This is a string.
[1] => here's another string.
[2] => And now there's a third string.
[3] => Here's a string that might not follow the pattern.
基本上,任何字符串不能有重複任何其他字符串中的文本。
不知道我是否合理。
編輯:
下面是完整的故事 - 我收集通過PHP IMAP電子郵件與AJAX腳本。我從每封電子郵件中獲得了正文的文本,但不幸的是,無法通過所有電子郵件服務查找引用文本。所以我做的是讓每個電子郵件正文顯示,並且我已經擺脫了任何額外的字符(如直線引用>>字符)。
我現在想要做的是:從第一封電子郵件開始,檢查其他電子郵件,並刪除第一個字符串(如果它在那裏),然後使用第二封電子郵件,檢查其餘電子郵件並刪除該字符串,等等。
這並不完美,但會縮短很多信息。
雙重for循環'indexOf'檢查。根據輸入的不同,輸出可能會非常糟糕。也許這對你來說很合理,對我來說這似乎很奇怪。 – Halcyon
你可以提供你的數據源,你收集你的價值 –
@AnikIslamAbhi,我已經添加了一個解釋的來源。 – ntgCleaner