{"id":395,"date":"2007-08-19T11:31:05","date_gmt":"2007-08-19T09:31:05","guid":{"rendered":"http:\/\/blog.marudina.net\/?p=395"},"modified":"2007-08-19T11:39:10","modified_gmt":"2007-08-19T09:39:10","slug":"unicode-40-%d0%b2-jdk-15","status":"publish","type":"post","link":"https:\/\/blog.marudina.net\/?p=395","title":{"rendered":"Unicode 4.0 ? JDK 1.5"},"content":{"rendered":"<p>???? ?? ????????? ? JDK 1.5 ?, ?? ???? ?? ???????? ????? ??-????? ????? ?? ??????? ???? ???????? ?? ????????? Unicode 4.0<\/p>\n<p>?????????? ?????? ??, ?? ???????? ?? ?????? ???? ??????? ?? ????? ?? ?? ??????? ? ???? <strong>char<\/strong>, ????? ? 16 ?????. ?? ???? ?????? ??????? ?? ??????? ???? ?????????? ?????? ??? <strong>code point<\/strong> &#8211; <strong>??? ??????? char-?<\/strong>, ????? ?? ????? ?? ?????? <strong>code unit<\/strong>. ??????? String.length ?????????? ?? ????? ???? char-??? ? ???????. ?? ??? ???? ????? ??????? ?? ??????? ? 2 char-?, ?? String.length ???? ?? ?? ? ???????, ????? ?? ?????? ??? ??????? ????????? ??????? ???? ???? ???????. ?? ???? ??? ??????? ??? ????? :<\/p>\n<p><code>int codePointCount(int beginIndex, int endIndex)<\/code><\/p>\n<p>???? ????? ????? ???? code points ??? ???????? unicode ??????? ???? ???? ???????? ?? ???????? ?? ?????? ??????? ???? ????.<\/p>\n<p>???? ???? ??? ?????? ?? ??????? n-??? ??????, String.charAt() ???? ?? ?? ?????? ?????? &#8211; ??? ???? ??? ?? ?????? n-??? char. ?? ???? ??? ? ???? ?????? :<\/p>\n<p><code>int offset = str.offsetByCodePoints(0, 3);<br \/>\nint codePnt = str.codePointAt(offset);<\/code><\/p>\n<p>??? ??????? ??????? ?? ?????? ?? ?????? ??? ????? char-?, ??????????? 3-??? ??????. ? ???? ???? ??????? ??????? (???? ??? ??? char-?) ?? ???????? ???????.<\/p>\n<p>? ???? ?????? ?? ??????, ???????? ???? ??????, ????? ?? ?????? ???? ?????? ?? char-??? :<\/p>\n<p><code>String str = \"\\uD800\\uDF30\";<br \/>\nSystem.out.println(\"str: \" + str);<br \/>\nSystem.out.println(\"str.length(): \" + str.length());<br \/>\nSystem.out.println(\"str.codePointCount(0, str.length()): \" + str.codePointCount(0, str.length()));<br \/>\nSystem.out.println(\"str.charAt(0): \" + (int)str.charAt(0));<br \/>\nSystem.out.println(\"str.charAt(1): \" + (int)str.charAt(1));<br \/>\nSystem.out.println(\"str.codePointAt(0): \" + str.codePointAt(0));<br \/>\nSystem.out.println(\"str.codePointAt(1): \" + str.codePointAt(1));<br \/>\n<\/code><\/p>\n<p><strong>?????<\/strong> : ??? ??????? ? ?????? ?? Unicode 4.0 ???????, ?????? ?? ??? ????? ?????????? ??? ??????? ???????? &#8211; ???????????, ?? ????? ????? ?????? ? ????? ???? char, ??? ?????????? ?? JDK 1.5 ??????? ????????? ?? ?????? ? ?????? ???-char-??? ???????. ??????, ?? ???????????? ?? Java ??? C++, ????? ????? ??????? ????????? ? ?????????????? ?? ????? ??????? ?? ????? ?????????? ???, ???? ????? ? ??????????.<\/p>\n<p>??? ???? ?? ?? ?????? ?? ?????????????????????, ? ??? ?? ???????? ?????????? ? ????????? ?? ?????? ?????, ?? ????? ???????.<\/p>\n<p><strong>??????? ???????:<\/strong><\/p>\n<ul>\n<li>?????????????? ?? ????? <a href=\"http:\/\/java.sun.com\/j2se\/1.5.0\/docs\/api\/java\/lang\/String.html\">String ? JDK 1.5 API<\/a>\n<\/li>\n<li><a href=\"http:\/\/java.sun.com\/mailers\/techtips\/corejava\/2006\/tt0822.html\">Strings &#8211; Core Java Technologies Technical Tips By John O&#8217;Conner<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>???? ?? ????????? ? JDK 1.5 ?, ?? ???? ?? ???????? ????? ??-????? ????? ?? ??????? ???? ???????? ?? ????????? Unicode 4.0 ?????????? ?????? ??, ?? ???????? ?? ?????? ???? ??????? ?? ????? ?? ?? ??????? ? ???? char, ????? ? 16 ?????. ?? ???? ?????? ??????? ?? ??????? ???? ?????????? ?????? ??? code point [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.marudina.net\/index.php?rest_route=\/wp\/v2\/posts\/395"}],"collection":[{"href":"https:\/\/blog.marudina.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.marudina.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.marudina.net\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.marudina.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=395"}],"version-history":[{"count":0,"href":"https:\/\/blog.marudina.net\/index.php?rest_route=\/wp\/v2\/posts\/395\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.marudina.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=395"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.marudina.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=395"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.marudina.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}