Getting the last word of an NSString

前端 未结 7 1079
滥情空心
滥情空心 2020-12-17 00:38

As the title suggests, I would like to get the last word out of an NSString. I thought using this code:

NSArray *listItems = [someNSStringHere componentsSepa         


        
7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-17 00:42

    You can read symbols from the end of the your string and copy them at the 0 index to result string. Whether you read space or comma, result string wil contain the last word

提交回复
热议问题