Obj-C,返回 nsarray 中找到的 nsstring 索引的函数?
我一直在寻找是否可以找到像indexOf 这样的函数。
我有一个数组。
self.data = [[NSArray alloc] initWithObjects:@"apple", @"lemon", @"pear", nil];
正在寻找一个返回函数来查找柠檬并返回 1 ?
I've been looking to see if I can find a function like indexOf.
I have an array.
self.data = [[NSArray alloc] initWithObjects:@"apple", @"lemon", @"pear", nil];
Looking for a function to return which would look for lemon and return 1 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
怎么样
indexOfObject:
?how about
indexOfObject:
?试试这个方法。
编辑:使用
-indexOfObject:
的另一个答案更好。Try this method.
EDIT: The other answer using
-indexOfObject:
is better.