在目标C字符串数组中搜索字符串 [英] String search in string array in objective c

查看:129
本文介绍了在目标C字符串数组中搜索字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在客观C字符串数组中搜索特定字符串。有人可以帮我在这方面?


解决方案

  BOOL isTheObjectThere = [myArray的containsObject:@我的字符串];

或者如果你需要知道它在哪里。

  NSUInteger indexOfTheObject = [myArray的indexOfObject:@我的字符串];

我强烈建议你阅读<一href=\"http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/NSArray.html#//apple_ref/doc/uid/20000137-BABDHGFB\">documentation在NSArray的的。事实上,你可能应该这样做可以发布您的问题之前: - )

I want to search a specific string in the array of strings in objective c. Can somebody help me in this regard?

解决方案

BOOL isTheObjectThere = [myArray containsObject: @"my string"];

or if you need to know where it is

NSUInteger indexOfTheObject = [myArray indexOfObject: @"my string"];

I strongly recommend you read the documentation on NSArray. In fact, you probably should have done that before posting your question :-)

这篇关于在目标C字符串数组中搜索字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆