RRN
RRN

Reputation: 1187

Search String in Char Array in IOS xcode program?

Char info[256]="Apple,iPhone,iPad";

I want to search in this char array, for example, search "iPhone" in the above array, Return TRUE since it contains this string.

How to do that in iOS xcode program? Thanks.

Upvotes: 0

Views: 441

Answers (1)

pro_metedor
pro_metedor

Reputation: 1176

Here it is:

BOOL stringInString(char *s1, char *s2)
{
    return (strstr(s1, s2) != NULL);
}

Upvotes: 1

Related Questions