{"id":623,"date":"2023-03-03T03:43:14","date_gmt":"2023-03-03T03:43:14","guid":{"rendered":"https:\/\/www.toolkit.keywordfinder.us\/?page_id=623"},"modified":"2023-03-03T03:43:14","modified_gmt":"2023-03-03T03:43:14","slug":"add-commas-to-numbers","status":"publish","type":"page","link":"https:\/\/tools.billionsideas.com\/es\/add-commas-to-numbers\/","title":{"rendered":"Add Commas to Numbers"},"content":{"rendered":"<label for=\"input\">Enter number:<\/label>\n<textarea id=\"input\" rows=\"5\"><\/textarea>\n<br>\n<label for=\"file-upload\">Or upload a file:<\/label>\n<input type=\"file\" id=\"file-upload\">\n<br>\n<label for=\"output\">Result:<\/label>\n<textarea id=\"output\" rows=\"5\" readonly=\"\"><\/textarea>\n<br>\n<button onclick=\"processInput()\">Add Commas<\/button>\n<button onclick=\"copyOutput()\">Copy Result<\/button>\n\n\n\n<style>\n\n<\/style>\n\n<script>\nfunction processInput() {\n  let input = \"\";\n  if (document.getElementById(\"file-upload\").files.length > 0) {\n    let file = document.getElementById(\"file-upload\").files[0];\n    let reader = new FileReader();\n    reader.onload = function(e) {\n      input = e.target.result;\n      let output = input.replace(\/\\B(?<!\\.\\d*)(?=(\\d{3})+(?!\\d))\/g, \",\");\n      document.getElementById(\"output\").value = output;\n    };\n    reader.readAsText(file);\n  } else {\n    input = document.getElementById(\"input\").value;\n    let output = input.replace(\/\\B(?<!\\.\\d*)(?=(\\d{3})+(?!\\d))\/g, \",\");\n    document.getElementById(\"output\").value = output;\n  }\n}\n\nfunction copyOutput() {\n  let output = document.getElementById(\"output\");\n  output.select();\n  document.execCommand(\"copy\");\n  alert(\"Result copied to clipboard!\");\n}\n\n<\/script>","protected":false},"excerpt":{"rendered":"<p>Enter number: Or upload a file: Result: Add Commas Copy Result<\/p>","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","footnotes":""},"class_list":["post-623","page","type-page","status-publish"],"taxonomy_info":[],"featured_image_src_large":false,"author_info":{"display_name":"Billions Ideas","author_link":"https:\/\/tools.billionsideas.com\/es\/author\/loginbillionsideas-com\/"},"comment_info":0,"jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tools.billionsideas.com\/es\/wp-json\/wp\/v2\/pages\/623","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tools.billionsideas.com\/es\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/tools.billionsideas.com\/es\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/tools.billionsideas.com\/es\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tools.billionsideas.com\/es\/wp-json\/wp\/v2\/comments?post=623"}],"version-history":[{"count":0,"href":"https:\/\/tools.billionsideas.com\/es\/wp-json\/wp\/v2\/pages\/623\/revisions"}],"wp:attachment":[{"href":"https:\/\/tools.billionsideas.com\/es\/wp-json\/wp\/v2\/media?parent=623"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}