Using OC to realize strtok function in C language

Source: Internet
Author: User
Tags strtok

#import  <foundation/foundation.h>int main (int argc, const char * argv []) {     @autoreleasepool  {        nsstring  *tempstr;        //the string that will be split          nsmutablestring * mutablestring=[[nsmutablestring alloc]initwithstring:@ "Hello, World!ni  hao "];        //the character set of the split string          NSCharacterSet * characterSet =[NSCharacterSet  charactersetwithcharactersinstring:@ ",! "];        // Save the split string with an array         NSArray *array=[mutableString  COMPONENTSSEPARATEDBYCHARACTERSINSET:CHARACTERSET];&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;//Fast Enumeration method         for  (TeMpstr in array)  {            nslog ( @ "%@", TempStr);        }         //Enumerator Method         nsenumerator * enumerator =[array  objectEnumerator];                 while  (Tempstr=[enumerator nextobject])  {             nslog (@ "%@", TempStr);        }     }    return 0;}

This article is from the Web Learning Summary blog, so be sure to keep this source http://8947509.blog.51cto.com/8937509/1556711

Using OC to realize strtok function in C language

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.