{"id":3778,"date":"2016-04-05T09:30:15","date_gmt":"2016-04-05T01:30:15","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=3778"},"modified":"2016-04-05T09:30:15","modified_gmt":"2016-04-05T01:30:15","slug":"qstring-%e6%96%b0%e5%a2%9e%e5%ad%97%e7%ac%a6%e4%b8%b2%e7%9a%84%e5%88%86%e9%9a%94%e5%87%bd%e6%95%b0-splitbystrw-%e5%92%8c-strbeforew-%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=3778","title":{"rendered":"[QString] \u65b0\u589e\u5b57\u7b26\u4e32\u7684\u5206\u9694\u51fd\u6570 SplitByStrW \u548c StrBeforeW \u51fd\u6570"},"content":{"rendered":"<h4>\u3010\u66f4\u65b0\u8bf4\u660e\u3011<\/h4>\n<p>StrBeforeW \u7528\u4e8e\u89e3\u6790\u7279\u5b9a\u5b57\u7b26\u4e32\u524d\u7684\u5b50\u4e32\uff0c\u6bd4\u5982\u5b57\u7b26\u4e32&#8221;Tommy and Jommy&#8221;\uff0c\u6211\u4eec\u8981\u53d6 &#8221; and&#8221; \u524d\u7684\u5b57\u7b26\u4e32\uff0c\u90a3\u4e48\uff0c\u7528StrBeforeW\u5c31\u53ef\u4ee5\u8f7b\u677e\u7684\u5206\u5272\u51fa\u6765\u3002<\/p>\n<p>SplitByStrW \u8c03\u7528 StrBeforeW \u5c06\u5f97\u5230\u7684\u5b50\u4e32\u52a0\u5165\u5230\u4e00\u4e2a\u5217\u8868\u4e2d\uff0c\u7c7b\u4f3c\u7684\u51fd\u6570SplitTokenW\u3002\u8fd9\u4e9b\u51fd\u6570\u63d0\u4f9b\u7684\u76ee\u7684\u662f\u7b80\u5316\u5b57\u7b26\u4e32\u7684\u5206\u9694\uff0c\u800c\u4e0d\u5fc5\u9700\u4f7f\u7528\u590d\u6742\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\uff08\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb8\u591a\u4eba\u7406\u89e3\u8d77\u6765\u8d39\u52b2\uff09\uff0c\u4e00\u6bb5\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n<pre class=\"lang:delphi decode:true \">procedure TForm1.Button1Click(Sender: TObject);\r\nvar\r\n  S: String;\r\nbegin\r\n  S := 'Jone or Tommy or Marry';\r\n  SplitByStrW(Memo1.Lines, S, ' or ', true);\r\nend;<\/pre>\n<p>\u540c\u6837\u7684\u5b9e\u73b0\uff0c\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\uff1a<\/p>\n<pre class=\"lang:delphi decode:true \">var\r\n  ARegex: TPerlRegex;\r\nbegin\r\n  ARegex := TPerlRegex.Create;\r\n  ARegex.Subject := 'Jone or Tommy or Marry';\r\n  ARegex.RegEx := '\\sor\\s';\r\n  ARegex.Split(Memo1.Lines, MaxInt);\r\n  FreeAndNil(ARegex);\r\nend;\r\n<\/pre>\n<p>\u901a\u8fc7\u5faa\u73af100\u4e07\u6b21\u6d4b\u8bd5\uff0c\u5bf9\u4e8e\u8fd9\u79cd\u4e0d\u662f\u7279\u522b\u590d\u6742\u7684\u5b57\u7b26\u4e32\u5206\u9694\uff0cSplitByStrW \u8981\u5feb\u4e0a\u7ea6\u4e00\u500d\u5de6\u53f3\uff08954ms\u00a0vs\u00a01734ms\uff09\u3002<\/p>\n<h4>\u3010\u66f4\u65b0\u7ea7\u522b\u3011<\/h4>\n<p>\u53ef\u9009<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3010\u66f4\u65b0\u8bf4\u660e\u3011 StrBeforeW \u7528\u4e8e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[145,69,8,9],"tags":[585,25],"class_list":["post-3778","post","type-post","status-publish","format-standard","hentry","category-android","category-c-builder","category-delphi","category-qdac","tag-585","tag-25"],"views":3241,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/3778","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3778"}],"version-history":[{"count":2,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/3778\/revisions"}],"predecessor-version":[{"id":3780,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/3778\/revisions\/3780"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3778"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3778"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3778"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}