如何在NSString中找到最後一個子字符串? - How do I find the last occurrence of a substring in an NSString?

問題:

How would I get the last occurrence of an NSString within another NSString? 如何在另一個NSString中獲得最後一次出現的NSString? For example, in "abc def ghi abc def ghi," I want to find the index of the second "abc," not the first. 例如,在“abc def ghi abc def ghi”中,我想找到第二個“abc”的索引,而不是第一個。 I know I could do this with a bunch of rangeOfStrings, but is there already a function for that? 我知道我可以用一堆rangeOfStrings做到這一點,但是它已經有了這個功能嗎?


解決方案:

參考: https://stackoom.com/en/question/AEn3
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章