許多Instagram的帖子結束與主題標籤過多,例如:我該如何明智地去掉Instagram標題中的所有尾隨標籤?
"This is one of the amazing Mountains you can find in the National Forest Park in #Zhangjiajie #Chinawhich is where James Cameron drew his inspiration for the flying mountains in #Avatar..
Credit: @phototravelnomads
#pictoura #gydr
#destinationearth #earthpix #ourlonelyplanet#wonderful_earthLife #timeoutsociety#fantastic_earthpics #liveoutdoors #igglobalclub#awesomeearth #mist_vision #earthdeluxe
# #worldbestgram #mthrworld #fantastic_earth#famouscaptures #destination_wow #dreamlifepix#wonderful_places #igworldclub #ig_global_life
#natureaddict #beautifuldestinations #traveler #guider#locals"
我期待處理字幕在年底將包括hashtag收集,同時不影響剩餘。這將是一個很好的方法來做到這一點?我敢肯定,我可以找出一種蠻橫的方式,但我希望得到一些優雅的解決方案的想法。不必是實際的代碼。 :)每burna的評論
編輯:預期的結果將是:每艾倫·摩爾的回答
"This is one of the amazing Mountains you can find in the National Forest Park in #Zhangjiajie #Chinawhich is where James Cameron drew his inspiration for the flying mountains in #Avatar..
Credit: @phototravelnomads"
編輯:這工作得很好,但不是在所有情況。例如,如果輸入的文字是:
"This is one of the amazing Mountains you can find in the National Forest Park in #Zhangjiajie #Chinawhich is where James Cameron drew his inspiration for the flying mountains in #Avatar"
......它會從「#張家界」中斷。
我想可能有更多的邏輯需要,也許將字符串拆分成數組;檢查它是否以hashtags結尾;如果是的話那麼多少;如果超過X(4?),則將其從最後一個完整系列中的第一個中刪除。
您可以在處理後添加預期結果嗎? – burna
歡迎來到SO!你的問題被自動格式化所打亂;你可以查看編輯歷史記錄,看看我做了什麼來修復它(當你在它的時候,檢查[幫助頁面](http://stackoverflow.com/editing-help)看看還有什麼可用的)。你應該在這裏預覽*你的帖子以及校對他們。 ;) –
@burna我編輯了這個問題,但我認爲艾倫摩爾已經回答了:) –