如何在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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章