{"id":1718,"date":"2015-05-05T09:36:00","date_gmt":"2015-05-05T00:36:00","guid":{"rendered":"http:\/\/excelwork.info\/excel\/?p=1718"},"modified":"2015-05-05T09:36:00","modified_gmt":"2015-05-05T00:36:00","slug":"characterlen","status":"publish","type":"post","link":"https:\/\/excelwork.info\/excel\/characterlen\/","title":{"rendered":"\u6587\u5b57\u5217\uff1a\u6587\u5b57\u5217\u306e\u9577\u3055\u3092\u53d6\u5f97\uff08 Len \u95a2\u6570\u3001LenB \u95a2\u6570 \uff09"},"content":{"rendered":"<h2>Len \u95a2\u6570\uff08\u6587\u5b57\u5217\u306e\u9577\u3055\u3092\u53d6\u5f97\uff09<\/h2>\n<br \/>\n<div class=\"m30-l\">\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p><em>result_len<\/em> = <strong>Len<\/strong> ( <em>string<\/em> )<\/p>\n<p><em>result_lenb<\/em> = <strong>LenB<\/strong> ( <em>string<\/em> )<\/p>\n<\/div>\n<br \/>\n<h3>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h3>\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>string&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u4efb\u610f\u306e\u6587\u5b57\u5217\u30fb\u6587\u5b57\u5217\u5f0f\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>result_len&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5f15\u6570 <em>string<\/em> \u306e\u6587\u5b57\u6570\uff08\u9577\u6574\u6570\u578b\uff1aLong\uff09\u3002<\/li>\n<li>result_lenb&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5f15\u6570 <em>string<\/em> \u306e\u30d0\u30a4\u30c8\u6570\uff08\u9577\u6574\u6570\u578b\uff1aLong\uff09\u3002<\/li>\n<\/ul>\n<br \/>\n<p class=\"caution4\">\u5f15\u6570 <em>string<\/em> \u304c\u3001<strong>Null \u5024<\/strong> \u3092\u542b\u3080\u5834\u5408\u306f\u3001<strong>Null \u5024<\/strong> \u3092\u8fd4\u3057\u307e\u3059<\/p>\n<p class=\"caution8\">\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u95a2\u6570\u306b\u3082 <strong>LenB \u95a2\u6570<\/strong> \u304c\u3042\u308a\u307e\u3059\u304c\u3001\u52d5\u4f5c\u304c\u7570\u306a\u308a\u307e\u3059\u3002VBA \u306e <strong>LenB \u95a2\u6570<\/strong> \u306e\u5834\u5408\u306f\u3001\u534a\u89d2\u30fb\u5168\u89d2\u306b\u304b\u304b\u308f\u3089\u305a<span class=\"red\">\u3059\u3079\u3066\u306e\u6587\u5b57\u3092\uff12\u30d0\u30a4\u30c8<\/span>\u3068\u3057\u3066\u6271\u3044\u307e\u3059\uff08Unicode \u3068\u3057\u3066\u6271\u3046\u305f\u3081\uff09\u3002\u4e00\u65b9\u306e\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u95a2\u6570\u306e <strong>LenB \u95a2\u6570<\/strong> \u306f\u3001<span class=\"red\">\u534a\u89d2\u6587\u5b57\u3092\uff11\u30d0\u30a4\u30c8\u3001\u5168\u89d2\u6587\u5b57\u3092\uff12\u30d0\u30a4\u30c8<\/span>\u3068\u3057\u3066\u6271\u3044\u307e\u3059\uff08ANSI \u3068\u3057\u3066\u6271\u3046\u305f\u3081\uff09\u3002<br \/>\n  VBA \u3067\u3001\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u95a2\u6570\u3068\u540c\u3058\u7d50\u679c\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081\u306b\u306f\u3001<strong>StrConv\u95a2\u6570<\/strong> \u3067\u3001\u6587\u5b57\u5217\u3092 <span class=\"red\">ANSI \u5f62\u5f0f<\/span>\u306b\u5909\u63db\u5f8c\u306b <strong>LenB \u95a2\u6570<\/strong> \u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<\/div>\n<br \/><br \/>\n<h2>Len \u95a2\u6570\u30fbLenB \u95a2\u6570 \u306e\u4f7f\u7528\u4f8b<\/h2>\n<div class=\"m30-l\">\n<h3 id=\"vba_sample\">\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b9<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"Len \u95a2\u6570\u3001LenB \u95a2\u6570\u306e\u4f7f\u7528\u4f8b\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\nSub Sample_Character01()\r\n\r\n    Dim str1 As String, str2, str3, str4, str5, str6, str7, strnull\r\n    \r\n    str1 = \"\u304a\u306f\u3088\u3046\uff01\"     '\u5168\u89d2\u6587\u5b57\u5217\r\n    str2 = \"\u3053\u3093\u306b\u3061\u306f\u3000\"   '\u5168\u89d2\u6587\u5b57\u5217\uff08\u5168\u89d2\u30b9\u30da\u30fc\u30b9\u3092\u542b\u3080\uff09\r\n    str3 = \"\u3042,\u3044 \u3046\"       '\u5168\u89d2\u6587\u5b57\u5217\u3001\u534a\u89d2\u30ab\u30f3\u30de\u3001\u534a\u89d2\u30b9\u30da\u30fc\u30b9\r\n    str4 = \"abcdefg\"        '\u534a\u89d2\u82f1\u5b57\r\n    str5 = 123              '\u6574\u6570\u5024\r\n    str6 = \"\"               '\u7a7a\u6587\u5b57\r\n    str7 = Chr(13)          '\u6539\u884c\u30b3\u30fc\u30c9\r\n    strnull = Null          'Null \u5024\r\n    \r\n    Debug.Print \"Len\uff08\u6587\u5b57\u6570\uff09\uff1a\" & Len(str1) & \"\u3000\" & \"LenB\uff08\u30d0\u30a4\u30c8\u6570\uff09\uff1a\" & LenB(str1)\r\n    Debug.Print \"Len\uff08\u6587\u5b57\u6570\uff09\uff1a\" & Len(str2) & \"\u3000\" & \"LenB\uff08\u30d0\u30a4\u30c8\u6570\uff09\uff1a\" & LenB(str2)\r\n    Debug.Print \"Len\uff08\u6587\u5b57\u6570\uff09\uff1a\" & Len(str3) & \"\u3000\" & \"LenB\uff08\u30d0\u30a4\u30c8\u6570\uff09\uff1a\" & LenB(str3)\r\n    Debug.Print \"Len\uff08\u6587\u5b57\u6570\uff09\uff1a\" & Len(str4) & \"\u3000\" & \"LenB\uff08\u30d0\u30a4\u30c8\u6570\uff09\uff1a\" & LenB(str4)\r\n    Debug.Print \"Len\uff08\u6587\u5b57\u6570\uff09\uff1a\" & Len(str5) & \"\u3000\" & \"LenB\uff08\u30d0\u30a4\u30c8\u6570\uff09\uff1a\" & LenB(str5)\r\n    Debug.Print \"Len\uff08\u6587\u5b57\u6570\uff09\uff1a\" & Len(str6) & \"\u3000\" & \"LenB\uff08\u30d0\u30a4\u30c8\u6570\uff09\uff1a\" & LenB(str6)\r\n    Debug.Print \"Len\uff08\u6587\u5b57\u6570\uff09\uff1a\" & Len(str7) & \"\u3000\" & \"LenB\uff08\u30d0\u30a4\u30c8\u6570\uff09\uff1a\" & LenB(str7)\r\n    Debug.Print IIf(IsNull(strnull), Null, \"Len\uff08\u6587\u5b57\u6570\uff09\uff1a\" & Len(strnull) & \"\u3000\" & \"LenB\uff08\u30d0\u30a4\u30c8\u6570\uff09\uff1a\" & LenB(strnull))\r\n\r\nEnd Sub\r\n\r\n\u3000\r\n<\/pre>\n<br \/>\n<h3>\u5b9f\u884c\u7d50\u679c<\/h3>\n<p><a href=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/lenlenb01.jpg?ssl=1\" rel=\"lightbox[1718]\"><img loading=\"lazy\" src=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/lenlenb01.jpg?resize=400%2C286&#038;ssl=1\" alt=\"Len \u95a2\u6570\u30fbLenB \u95a2\u6570 \u4f8b\" width=\"400\" height=\"286\" class=\"alignnone size-medium wp-image-1720\" srcset=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/lenlenb01.jpg?resize=400%2C286&amp;ssl=1 400w, https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/lenlenb01.jpg?resize=580%2C415&amp;ssl=1 580w, https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/lenlenb01.jpg?w=914&amp;ssl=1 914w\" sizes=\"(max-width: 400px) 100vw, 400px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<br \/><\/div>\n<br \/><br \/>\n","protected":false},"excerpt":{"rendered":"<p>Len \u95a2\u6570\uff08\u6587\u5b57\u5217\u306e\u9577\u3055\u3092\u53d6\u5f97\uff09 \u3010\u66f8\u5f0f\u3011 result_len = Len  &#8230; <\/p>\n","protected":false},"author":1,"featured_media":1722,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"amp_status":"","spay_email":"","jetpack_publicize_message":"\u6587\u5b57\u5217\uff1a\u6587\u5b57\u5217\u306e\u9577\u3055\u3092\u53d6\u5f97\uff08 Len \u95a2\u6570\u3001LenB \u95a2\u6570 \uff09"},"categories":[37],"tags":[185,186,63,38,187],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/lenlenb01-400x2861.jpg?fit=400%2C286&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4Ye9i-rI","_links":{"self":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/1718"}],"collection":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/comments?post=1718"}],"version-history":[{"count":2,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/1718\/revisions"}],"predecessor-version":[{"id":1721,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/1718\/revisions\/1721"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media\/1722"}],"wp:attachment":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media?parent=1718"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/categories?post=1718"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/tags?post=1718"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}