{"id":5292,"date":"2026-05-06T20:30:00","date_gmt":"2026-05-06T11:30:00","guid":{"rendered":"https:\/\/4771labo.com\/?page_id=5292"},"modified":"2026-05-13T21:14:28","modified_gmt":"2026-05-13T12:14:28","slug":"%e5%8f%a4%e6%96%87%e6%9b%b8%e8%a7%a3%e6%9e%90%e3%82%b7%e3%82%b9%e3%83%86%e3%83%a0%ef%bc%88%e5%9f%ba%e6%95%b0%e5%a4%89%e6%8f%9b%ef%bc%89","status":"publish","type":"page","link":"https:\/\/4771labo.com\/?page_id=5292","title":{"rendered":"\u53e4\u6587\u66f8\u89e3\u6790\u30b7\u30b9\u30c6\u30e0\uff08\u57fa\u6570\u5909\u63db\uff09"},"content":{"rendered":"\n<p>\u6570\u5b57\u306e\u57fa\u6570\u5909\u63db\uff0810\u9032\u6570\u2192n\u9032\u6570\uff09\u306b\u5909\u63db\u3057\u307e\u3059\u3002<br>\u4e00\u822c\u7684\u306b\u306f2\u9032\u6570\u30018\u9032\u6570\u300116\u9032\u6570\u304c\u738b\u9053\u3067\u3059\u304c\u300162\u9032\u6570\u307e\u3067\u5bfe\u5fdc\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div id=\"base-converter\" style=\"border: 1px solid #ccc; padding: 20px; border-radius: 8px; font-family: sans-serif; width:100%; margin: auto; background: #f9f9f9; color: #333;\">\n    <h3 style=\"margin-top: 0; \" id=\"i-0\">\u4e07\u80fd\u57fa\u6570\u5909\u63db\u30c4\u30fc\u30eb<\/h3>\n    \n    <div style=\"margin-bottom: 15px;\">\n        <label style=\"display: block; font-size: 0.9em; margin-bottom: 5px; font-weight: bold;\">\u5909\u63db\u3057\u305f\u3044\u6570\u5024:<\/label>\n        <!-- oninput\u3067\u534a\u89d2\u82f1\u6570\u5b57\u4ee5\u5916\u3092\u5373\u5ea7\u306b\u6d88\u53bb -->\n        <input type=\"text\" id=\"inputValue\" inputmode=\"email\" maxlength=\"64\" placeholder=\"\u6570\u5024\u3092\u5165\u529b\uff0864\u6587\u5b57\u307e\u3067\uff09\" oninput=\"this.value = this.value.replace(\/[\uff21-\uff3a\uff41-\uff5a\uff10-\uff19]\/g, s => String.fromCharCode(s.charCodeAt(0) \u2013 0xFEE0)).replace(\/[^a-zA-Z0-9]\/g, \u201d)\u201d\n            onkeyup=\u201dexecuteConvert()\u201d\n            style=\u201dwidth: 100%; padding: 10px; box-sizing: border-box; border: 1px solid #bbb; border-radius: 4px; font-size: 1.1em;\u201d\n            autofocus>\n    <\/div>\n\n\n\n    <!-- \u57fa\u6570\u9078\u629e\u30a8\u30ea\u30a2 -->\n    <div style=\" width: clear: both margin-bottom: overflow: hidden>\n    \n        <!-- \u5de6\uff1a\u5143\u306e\u57fa\u6570 -->\n        <div style=\"width: 43% !important; float: left !important;\">\n            <label style=\"font-size: 0.8em; color: #666; display: block; margin-bottom: 5px;\">\u5143\u306e\u57fa\u6570<\/label>\n            <select id=\"fromBase\" style=\"width: 100% !important; padding: 10px !important; border-radius: 4px; border: 1px solid #bbb; background: #fff; appearance: auto !important; -webkit-appearance: auto !important;\"><\/select>\n        <\/div>\n\n        <!-- \u4e2d\u592e\uff1a\u77e2\u5370 -->\n        <div style=\"width: 14% !important; float: left !important; text-align: center; padding-top: 40px; font-weight: bold; color: #445555;\">\u27a1<\/div>\n\n        <!-- \u53f3\uff1a\u5909\u63db\u5f8c\u306e\u57fa\u6570 -->\n        <div style=\"width: 43% !important; float: left !important;\">\n            <label style=\"font-size: 0.8em; color: #666; display: block; margin-bottom: 5px;\">\u5909\u63db\u5f8c\u306e\u57fa\u6570<\/label>\n            <select id=\"toBase\" style=\"width: 100% !important; padding: 10px !important; border-radius: 4px; border: 1px solid #bbb; background: #fff; appearance: auto !important; -webkit-appearance: auto !important;\"><\/select>\n        <\/div>\n\n        <div style=\"clear: both !important;\"><\/div>\n    <\/div>\n\n\n<!-- \u30dc\u30bf\u30f3\u306e\u524d\u306b\u5f37\u5236\u30ea\u30bb\u30c3\u30c8\u3092\u5165\u308c\u308b -->\n<div style=\"clear: both !important; width: 100% !important; padding-top: 10px;\">\n    <button onclick=\"executeConvert()\" id=\"startBtn\" style=\"\n        width: 100% !important; \n        display: block !important; \n        padding: 15px !important; \n        background-color: #445555 !important; \n        color: white !important; \n        border: none !important; \n        border-radius: 4px !important; \n        cursor: pointer !important; \n        font-size: 1.1em !important;\n        box-sizing: border-box !important;\n    \">\u5909\u63db\u3092\u5b9f\u884c<\/button>\n<\/div>\n\n    <div style=\"margin-top: 20px; padding: 15px; background: #fff; border: 1px solid #445555; border-radius: 4px;\">\n        <label style=\"display: block; font-size: 0.8em; color: #666; margin-bottom: 5px;\">\u5909\u63db\u7d50\u679c:<\/label>\n<div id=\"outputResult\" style=\"word-break: break-all; font-weight: bold; font-size: 1.4em; color: #333; min-height: 1.5em; max-height: 200px; overflow-y: auto;\">\u2013<\/div>\n    <\/div>\n<\/div>\n\n<script>\nconst CHARS = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\";\n\n\/\/ \u30d7\u30eb\u30c0\u30a6\u30f3\u751f\u6210\nfunction setupSelects() {\n    const fromSelect = document.getElementById('fromBase');\n    const toSelect = document.getElementById('toBase');\n    const mainBases = [10, 2, 8, 16];\n    const createOption = (val) => {\n        const opt = document.createElement('option');\n        opt.value = val;\n        opt.textContent = `${val}\u9032\u6570` + (val === 10 ? ' (\u5e38\u7528)' : '');\n        return opt;\n    };\n    mainBases.forEach(b => {\n        fromSelect.appendChild(createOption(b));\n        toSelect.appendChild(createOption(b));\n    });\n    const hr = document.createElement('option');\n    hr.disabled = true; hr.textContent = \"----------\";\n    fromSelect.appendChild(hr.cloneNode(true));\n    toSelect.appendChild(hr.cloneNode(true));\n\n    for (let i = 2; i <= 62; i++) {\n        if (!mainBases.includes(i)) {\n            fromSelect.appendChild(createOption(i));\n            toSelect.appendChild(createOption(i));\n        }\n    }\n    fromSelect.value = 10;\n    toSelect.value = 2;\n}\n\n\/\/ \u5909\u63db\u5b9f\u884c\nfunction executeConvert() {\n    const inputField = document.getElementById('inputValue');\n    let val = inputField.value.trim(); \/\/ const\u304b\u3089let\u306b\u5909\u66f4\n    const fromBase = parseInt(document.getElementById('fromBase').value);\n    const toBase = parseInt(document.getElementById('toBase').value);\n    const output = document.getElementById('outputResult');\n\n    inputField.focus();\n\n    if (!val) {\n        output.innerText = \"\u5024\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\";\n        output.style.color = \"#660000\";\n        return;\n    }\n\n    if (val.length > 64) {\n        output.innerText = \"\u30a8\u30e9\u30fc: \u5165\u529b\u304c\u9577\u3059\u304e\u307e\u3059\uff0864\u6587\u5b57\u4ee5\u5185\uff09\";\n        output.style.color = \"#660000\";\n        return;\n    }\n\n    \/\/ \u3010\u8ffd\u52a0\u301136\u9032\u6570\u4ee5\u4e0b\u306a\u3089\u3001\u5c0f\u6587\u5b57\u3092\u5927\u6587\u5b57\u306b\u5909\u63db\u3057\u3066\u3042\u3052\u308b\uff08\u89aa\u5207\u8a2d\u8a08\uff09\n    if (fromBase <= 36) {\n        val = val.toUpperCase();\n    }\n\n    try {\n        let decimalValue = BigInt(0);\n        const fromBaseBI = BigInt(fromBase);\n        \n        for (let i = 0; i < val.length; i++) {\n            const charIndex = CHARS.indexOf(val[i]);\n            \/\/ \u3053\u3053\u3067\u7bc4\u56f2\u30c1\u30a7\u30c3\u30af\n            if (charIndex === -1 || charIndex >= fromBase) {\n                throw new Error(`${fromBase}\u9032\u6570\u306b\u306f\u4f7f\u3048\u306a\u3044\u6587\u5b57\u300c${val[i]}\u300d\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059`);\n            }\n            decimalValue = decimalValue * fromBaseBI + BigInt(charIndex);\n        }\n\n        if (decimalValue === BigInt(0)) {\n            output.innerText = \"0\";\n            output.style.color = \"#333\";\n            return;\n        }\n\n        let result = \"\";\n        const toBaseBI = BigInt(toBase);\n        let tempDecimal = decimalValue;\n        while (tempDecimal > 0) {\n            result = CHARS[Number(tempDecimal % toBaseBI)] + result;\n            tempDecimal = tempDecimal \/ toBaseBI;\n        }\n        \n        \/\/ \u3010\u8ffd\u52a0\u301136\u9032\u6570\u4ee5\u4e0b\u3078\u306e\u5909\u63db\u306a\u3089\u3001\u7d50\u679c\u3092\u898b\u3084\u3059\u304f\u5927\u6587\u5b57\u306b\u3059\u308b\n        output.innerText = (toBase <= 36) ? result.toUpperCase() : result;\n        output.style.color = \"#333\";\n    } catch (e) {\n        output.innerText = \"\u30a8\u30e9\u30fc: \" + e.message;\n        output.style.color = \"red\";\n    }\n}\n\n\/\/ Enter\u30ad\u30fc\u3067\u3082\u5b9f\u884c\u3067\u304d\u308b\u3088\u3046\u306b\ndocument.getElementById('inputValue').addEventListener('keypress', function (e) {\n    if (e.key === 'Enter') {\n        executeConvert();\n    }\n});\n\nsetupSelects();\ndocument.getElementById('inputValue').focus();\n<\/script>\n","protected":false},"excerpt":{"rendered":"<p>\u6570\u5b57\u306e\u57fa\u6570\u5909\u63db\uff0810\u9032\u6570\u2192n\u9032\u6570\uff09\u306b\u5909\u63db\u3057\u307e\u3059\u3002\u4e00\u822c\u7684\u306b\u306f2\u9032\u6570\u30018\u9032\u6570\u300116\u9032\u6570\u304c\u738b\u9053\u3067\u3059\u304c\u300162\u9032\u6570\u307e\u3067\u5bfe\u5fdc\u3057\u307e\u3059\u3002 \u4e07\u80fd\u57fa\u6570\u5909\u63db\u30c4\u30fc\u30eb \u5909\u63db\u3057\u305f\u3044\u6570\u5024:<\/p>\n","protected":false},"author":1,"featured_media":4137,"parent":2216,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":{"0":"post-5292","1":"page","2":"type-page","3":"status-publish","4":"has-post-thumbnail","6":"entry"},"_links":{"self":[{"href":"https:\/\/4771labo.com\/index.php?rest_route=\/wp\/v2\/pages\/5292","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/4771labo.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/4771labo.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/4771labo.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/4771labo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5292"}],"version-history":[{"count":34,"href":"https:\/\/4771labo.com\/index.php?rest_route=\/wp\/v2\/pages\/5292\/revisions"}],"predecessor-version":[{"id":5445,"href":"https:\/\/4771labo.com\/index.php?rest_route=\/wp\/v2\/pages\/5292\/revisions\/5445"}],"up":[{"embeddable":true,"href":"https:\/\/4771labo.com\/index.php?rest_route=\/wp\/v2\/pages\/2216"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/4771labo.com\/index.php?rest_route=\/wp\/v2\/media\/4137"}],"wp:attachment":[{"href":"https:\/\/4771labo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}