{"id":581,"date":"2003-08-03T17:45:38","date_gmt":"2003-08-03T21:45:38","guid":{"rendered":"\/?p=581"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-30T04:00:00","slug":"tokenizing_in_cocoa","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2003\/08\/03\/tokenizing_in_cocoa\/","title":{"rendered":"Tokenizing in Cocoa"},"content":{"rendered":"<p>\nI don&rsquo;t have numbers, but I was somewhat surprised to discover that, for my use, it&rsquo;s faster to convert a string to a UTF-8 buffer and feed it to <a href=\"http:\/\/www.pcre.org\">PCRE<\/a> than it is to use <a href=\"http:\/\/developer.apple.com\/documentation\/Cocoa\/Reference\/Foundation\/ObjC_classic\/Classes\/NSScanner.html#\/\/apple_ref\/occ\/cl\/NSScanner\">NSScanner<\/a> and <a href=\"http:\/\/developer.apple.com\/documentation\/Cocoa\/Reference\/Foundation\/ObjC_classic\/Classes\/NSCharacterSet.html#\/\/apple_ref\/occ\/cl\/NSCharacterSet\">NSCharacterSet<\/a>. If you do end up using <code>NSScanner<\/code>, be sure to use <code>-scanUpToCharactersFromSet:intoString:<\/code> rather than <code>-scanCharactersFromSet:intoString:<\/code>. The latter spends a lot of time inverting the character set.\n<\/p>","protected":false},"excerpt":{"rendered":"<p>I don&rsquo;t have numbers, but I was somewhat surprised to discover that, for my use, it&rsquo;s faster to convert a string to a UTF-8 buffer and feed it to PCRE than it is to use NSScanner and NSCharacterSet. If you do end up using NSScanner, be sure to use -scanUpToCharactersFromSet:intoString: rather than -scanCharactersFromSet:intoString:. The latter [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-581","post","type-post","status-publish","format-standard","hentry","category-programming-category"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/581","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=581"}],"version-history":[{"count":0,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/581\/revisions"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=581"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=581"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=581"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}