How do I use NSRange with this NSString?

前端 未结 3 419
Happy的楠姐
Happy的楠姐 2021-01-22 02:33

I have the following NSString:

productID = @\"com.sortitapps.themes.pink.book\";

At the end, \"book\" can be anything.... \"music\

3条回答
  •  一个人的身影
    2021-01-22 03:00

    Well, although this isn't a generic solution for finding characters, in your particular case you can "cheat" and save code by doing this:

    [productID stringByDeletingPathExtension];
    

    Essentially, I'm treating the name as a filename and removing the last (and only the last) extension using the NSString method for this purpose.

提交回复
热议问题