{"id":438,"date":"2015-03-09T03:47:30","date_gmt":"2015-03-08T18:47:30","guid":{"rendered":"http:\/\/yoriki.jp\/wordpress\/?p=438"},"modified":"2015-03-09T03:47:30","modified_gmt":"2015-03-08T18:47:30","slug":"delphi%e3%81%a7%e3%80%81%e3%82%b5%e3%83%ad%e3%82%b2%e3%83%bc%e3%83%88%e6%96%87%e5%ad%97%e3%81%a8ivs%e3%81%ab%e5%af%be%e5%bf%9c","status":"publish","type":"post","link":"https:\/\/yoriki.jp\/tool\/wordpress\/?p=438","title":{"rendered":"Delphi\u3067\u3001\u30b5\u30ed\u30b2\u30fc\u30c8\u6587\u5b57\u3068IVS\u306b\u5bfe\u5fdc"},"content":{"rendered":"<p>\u4ed5\u4e8b\u3067\u3001\u540d\u524d\u3092\u767b\u9332\u3057\u3066\u4f7f\u7528\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u3063\u3066\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u4eca\u307e\u3067\u306f\u3001unicode\u306eBMP\u3060\u3051\u3092\u4f7f\u7528\u3057\u3066\u305d\u308c\u4ee5\u5916\u306f\u3001\u5916\u5b57\u3067\u5bfe\u51e6\u3057\u3066\u3044\u305f\u3093\u3067\u3059\u304c\u3001\u6700\u8fd1\u3001\u30b5\u30ed\u30b2\u30fc\u30c8\u6587\u5b57\u3084IVS\u3068\u3044\u3046\u3082\u306e\u304c\u3042\u308b\u3053\u3068\u306b\u9045\u308c\u3070\u305b\u306a\u304c\u3089\u6c17\u304c\u3064\u304d\u307e\u3057\u305f\u3002\u6628\u5e74\u672b\u306b\u4ed5\u4e8b\u5834\u306e\u30d1\u30bd\u30b3\u30f3\u304cWindows8.1\u306b\u306a\u3063\u3066\u304b\u3089\u3001\u3053\u306e\u3053\u3068\u306b\u6c17\u304c\u3064\u304d\u3001\u8fbb\u306e\uff11\u70b9\u3057\u3093\u306b\u3087\u3046\u3068\uff12\u70b9\u3057\u3093\u306b\u3087\u3046\u306e\uff12\u3064\u3092\u304b\u304d\u5206\u3051\u308b\u3053\u3068\u304c\u53ef\u80fd\u3068\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001\u79c1\u306e\u81ea\u4f5c\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u3001\u3053\u308c\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u305a\u3001\u57fa\u5e95\u6587\u5b57\u306e\u5f8c\u306b??\u304c\u3064\u304f\u3068\u3044\u3046\u4e0d\u5177\u5408\u304c\u3067\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002\u3053\u308c\u306f\u3001length, copy \u95a2\u6570\u304c\u6b63\u5e38\u306b\u52d5\u4f5c\u3057\u3066\u3044\u306a\u3044\u3053\u3068\u306b\u539f\u56e0\u304c\u3042\u308b\u3053\u3068\u304c\u308f\u304b\u3063\u305f\u306e\u3067\u3001\u65e9\u901f\u3001\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u3067\u30b5\u30ed\u30b2\u30fc\u30c8\u3068IVS\u306b\u3064\u3044\u3066\u691c\u7d22\u3057\u3066\u307f\u307e\u3057\u305f\u304c\u3001\u6df1\u307f\u306b\u306f\u307e\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002\u305d\u3057\u3066\u3001\u4f55\u3068\u304b\u3001\u95a2\u6570\u3092\u4f5c\u308a\u4e0a\u3052\u305f\u3082\u306e\u306e\u3001\u3055\u3089\u306b\u7d50\u5408\u6587\u5b57\u3068\u3044\u3046\u3082\u306e\u304c\u3042\u308b\u3053\u3068\u306b\u6c17\u304c\u3064\u304d\u3001\u632b\u6298\u3068\u59a5\u5354\u3092\u3057\u304b\u3051\u307e\u3057\u305f\u304c\u3001<a href=\"http:\/\/edn.embarcadero.com\/jp\/article\/38816\">\u30a8\u30f3\u30d0\u30ab\u30a8\u30ed\u306e\u30b5\u30a4\u30c8\u306b\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9<\/a>\u304c\u3042\u308a\u3001\u3053\u308c\u3092\u62dd\u501f\u3059\u308b\u3053\u3068\u306b\u3088\u308a\u3001\u307b\u307c\u601d\u3046\u901a\u308a\u306e\u52d5\u4f5c\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><!--more--><\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u3001\u79c1\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u5fc5\u8981\u306a\u3001length, copy\u95a2\u6570\u306e\u307f\u4f5c\u6210\u3057\u305f\u3082\u306e\u3092\uff08\u3069\u7d20\u4eba\u306e\u5168\u304f\u6d17\u7df4\u3055\u308c\u3066\u3044\u306a\u3044\u30b3\u30fc\u30c9\u3067\u3059\u304c\uff09\u53c2\u8003\u3068\u3057\u3066\u4e0a\u3052\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<pre lang=\"delphi\" line=\"1\">\nconst\n  surrogate_high_Start = $D800;\n  surrogate_high_End   = $DBFF;\n  surrogate_low_Start  = $DC00;\n  surrogate_low_End    = $DFFF;\n\n  LangSelect = $DB40;\n\n---------------------------------------------------------\n\nfunction IVS_copy(str: String; s0, e0: Integer): String;\nvar\n  i : Integer;\n  n, n1, len : Integer;\n  ch : array of Integer;\n  s1, e1, e2 : Integer;\n  str0 : string;\nbegin\n  if MecsNormalize(str, str0, NormalizationC) then\n    str := str0;\n\n  len := IVS_Length(str);\n\n  SetLength(ch, len+1);\n  for i := 0 to len do\n    ch[i] := 0;\n\n  n := 1;\n  n1 := 1;\n  repeat\n    if (ord(str[n]) < surrogate_high_Start) or (ord(str[n]) > surrogate_high_End) then\n    begin\n      ch[n1] := 1;\n      n1 := n1 + 1;\n      n := n + 1;\n    end\n    else if ord(str[n]) = LangSelect then\n    begin\n      ch[n1-1] := ch[n1-1] + 2;\n      n := n + 2;\n    end\n    else\n    begin\n      ch[n1] := 2;\n      n1 := n1 + 1;\n      n := n + 2;\n    end;\n  until n > length(str);\n\n  s1 := 0;\n  for i := 1 to s0-1 do\n    s1 := s1 + ch[i];\n  s1 := s1 + 1;\n\n  e1 := 0;\n  e2 := s0 + e0 - 1;\n  if e2 > len then\n    e2 := len;\n  for i := s0 to e2 do\n    e1 := e1 + ch[i];\n\n  result := copy(str, s1, e1);\nend;\n\n\/\/  \u30b5\u30ed\u30b2\u30fc\u30c8\u6587\u5b57\u3001IVS\u4ed8\u304d\u306e\u6587\u5b57\u3067\u3082\u3001\u6587\u5b57\u5217\u306e\u9577\u3055\u3092\u6b63\u78ba\u306b\u51fa\u3059\nfunction IVS_length(s: String): Integer;\nvar\n  i : Integer;\n  count : Integer;\n  s0 : String;\nbegin\n  if MecsNormalize(s, s0, NormalizationC) then\n    s := s0;\n\n  count := 0;\n  for i := 1 to length(s) do\n    if not((ord(s[i]) = LangSelect) or (ord(s[i]) >= surrogate_low_Start)and(ord(s[i]) <= surrogate_low_End)) then\n    begin\n      inc(count);\n    end;\n\n  result := count;\nend;\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4ed5\u4e8b\u3067\u3001\u540d\u524d\u3092\u767b\u9332\u3057\u3066\u4f7f\u7528\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u3063\u3066\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002 \u4eca\u307e\u3067\u306f\u3001unicode\u306eBMP\u3060\u3051\u3092\u4f7f\u7528\u3057\u3066\u305d\u308c\u4ee5\u5916\u306f\u3001\u5916\u5b57\u3067\u5bfe\u51e6\u3057\u3066\u3044\u305f\u3093\u3067\u3059\u304c\u3001\u6700\u8fd1\u3001\u30b5\u30ed\u30b2\u30fc\u30c8\u6587\u5b57\u3084IVS\u3068\u3044\u3046\u3082\u306e\u304c\u3042\u308b\u3053\u3068\u306b\u9045\u308c\u3070\u305b\u306a\u304c\u3089\u6c17\u304c\u3064 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-438","post","type-post","status-publish","format-standard","hentry","category-delphi"],"_links":{"self":[{"href":"https:\/\/yoriki.jp\/tool\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/438","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yoriki.jp\/tool\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yoriki.jp\/tool\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yoriki.jp\/tool\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/yoriki.jp\/tool\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=438"}],"version-history":[{"count":0,"href":"https:\/\/yoriki.jp\/tool\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/438\/revisions"}],"wp:attachment":[{"href":"https:\/\/yoriki.jp\/tool\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=438"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yoriki.jp\/tool\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=438"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yoriki.jp\/tool\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=438"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}