{"id":1779,"date":"2015-05-08T11:11:35","date_gmt":"2015-05-08T02:11:35","guid":{"rendered":"http:\/\/excelwork.info\/excel\/?p=1779"},"modified":"2015-05-08T11:11:35","modified_gmt":"2015-05-08T02:11:35","slug":"characterreplace","status":"publish","type":"post","link":"https:\/\/excelwork.info\/excel\/characterreplace\/","title":{"rendered":"\u6587\u5b57\u5217\uff1a\u6587\u5b57\u5217\u306e\u4e00\u90e8\u3092\u5225\u306e\u6587\u5b57\u5217\u3067\u7f6e\u63db\uff08Replace \u95a2\u6570\uff09"},"content":{"rendered":"<h2>Replace \u95a2\u6570\u306e\u4f7f\u3044\u65b9<\/h2>\n<br \/>\n<div class=\"m30-l\">\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p><em>result<\/em> = <strong>Replace<\/strong> ( <em>string<\/em>, <em>find<\/em>, <em>replace<\/em> [, <em>start<\/em>, <em>count<\/em>, <em>compare<\/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\uff08\u7f6e\u63db\u3059\u308b\u6587\u5b57\u5217\u3092\u542b\u3080\uff09\u3002<\/li>\n<li>find&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u691c\u7d22\u3059\u308b\u6587\u5b57\u5217\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>replace&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u7f6e\u63db\u3059\u308b\u6587\u5b57\u5217\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>start&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5f15\u6570 <em>string<\/em> \u5185\u3067\u3001\u6587\u5b57\u5217 <em>find<\/em> \u306e\u691c\u7d22\u3092\u958b\u59cb\u3059\u308b\u4f4d\u7f6e\u3092\u3057\u3066\u3044\u3057\u307e\u3059\u3002\u5de6\u7aef\u306e\u6587\u5b57\u3092\u300c1\u300d\u3068\u3057\u307e\u3059\u3002\u7701\u7565\u3059\u308b\u3068\u300c1\u300d\u304c\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002<\/li>\n<li>count&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u7f6e\u63db\u3059\u308b\u6587\u5b57\u5217\u306e\u56de\u6570\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u300c-1\u300d\u3092\u6307\u5b9a\u3059\u308b\u3068\u3059\u3079\u3066\u306e\u5019\u88dc\u304c\u7f6e\u63db\u3055\u308c\u307e\u3059\u3002\u7701\u7565\u3059\u308b\u3068\u300c-1\u300d\u304c\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002<\/li>\n<li>compare&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u6587\u5b57\u5217\u3092\u6bd4\u8f03\u3059\u308b\u3068\u304d\u306e\u6bd4\u8f03\u30e2\u30fc\u30c9\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\uff08\u8a2d\u5b9a\u3059\u308b\u5024\u306f\u3001\u4e0b\u8868\u300c<em>compare<\/em> \u306e\u8a2d\u5b9a\u5024\u300d\u3092\u53c2\u7167\uff09<\/li>\n<li>result&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5f15\u6570 <em>string<\/em> \u306e\u4e2d\u3067\u3001<em>start<\/em> \u306e\u4f4d\u7f6e\u4ee5\u964d\u3067\u3001<em>find<\/em> \u3092 <em>replace<\/em> \u3067\u3001<em>count<\/em> \u3067\u6307\u5b9a\u3055\u308c\u305f\u56de\u6570\u5206\uff08 <em>count<\/em> \u304c\u300c-1\u300d\u306e\u5834\u5408\u306f\u3059\u3079\u3066\uff09\u7f6e\u63db\u3057\u305f\u7d50\u679c\uff08\u6587\u5b57\u5217\u578b\uff1aString\uff09\u3002<br \/><br \/>\n  \u3010<span class=\"red\"><strong>Replace \u95a2\u6570\u306e\u623b\u308a\u5024\u306b\u3064\u3044\u3066<\/strong><\/span>\u3011<\/p>\n<table>\n<tr>\n<td><strong>\u6761\u4ef6<\/strong><\/td>\n<td><strong>\u623b\u308a\u5024<\/strong><\/td>\n<\/tr>\n<tr>\n<td>\u5f15\u6570 <em>strong<\/em> \u304c\u9577\u3055\uff10\u306e\u6587\u5b57\u5217(&#8220;&#8221;)<\/td>\n<td>\u9577\u3055\uff10\u306e\u6587\u5b57\u5217(&#8220;&#8221;)<\/td>\n<\/tr>\n<tr>\n<td>\u5f15\u6570 <em>strong<\/em> \u304c Null \u5024\u3092\u542b\u3080<\/td>\n<td>\u30a8\u30e9\u30fc<\/td>\n<\/tr>\n<tr>\n<td>\u5f15\u6570 <em>find<\/em> \u304c\u9577\u3055\uff10\u306e\u6587\u5b57\u5217(&#8220;&#8221;)<\/td>\n<td>\u5f15\u6570 <em>strong<\/em> \u306e\u30b3\u30d4\u30fc<\/td>\n<\/tr>\n<tr>\n<td>\u5f15\u6570 <em>start<\/em> \u304c\u3001\u5f15\u6570 <em>string<\/em> \u306e\u6587\u5b57\u6570\u3088\u308a\u5927\u304d\u3044\u5834\u5408<\/td>\n<td>\u9577\u3055\uff10\u306e\u6587\u5b57\u5217(&#8220;&#8221;)<\/td>\n<\/tr>\n<tr>\n<td>\u5f15\u6570 <em>count<\/em> \u304c 0 \u306e\u5834\u5408<\/td>\n<td>\u5f15\u6570 <em>strong<\/em> \u306e\u30b3\u30d4\u30fc<\/td>\n<\/tr>\n<\/table>\n<\/li>\n<\/ul>\n<br \/><br \/>\n<p class=\"caution4\"><strong><em>compare<\/em> \u306e\u8a2d\u5b9a\u5024<\/strong><\/p>\n<table>\n<tr>\n<td align = \"center\"><strong>\u5024<\/strong><\/td>\n<td><strong>\u5b9a\u6570<\/strong><\/td>\n<td><strong>\u5185\u5bb9<\/strong><\/td>\n<\/tr>\n<tr>\n<td align = \"center\">-1<\/td>\n<td>vbUseCompareOption<\/td>\n<td><strong>Option Compare<\/strong> \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u306e\u8a2d\u5b9a\u3092\u4f7f\u7528\u3057\u3066\u6bd4\u8f03<\/td>\n<\/tr>\n<tr>\n<td align = \"center\">0<\/td>\n<td>vbBinaryCompare<\/td>\n<td>\u30d0\u30a4\u30ca\u30ea\u30e2\u30fc\u30c9\u3067\u6bd4\u8f03\uff08\u898f\u5b9a\u5024\uff09<\/td>\n<\/tr>\n<tr>\n<td align = \"center\">1<\/td>\n<td>vbTextCompare<\/td>\n<td>\u30c6\u30ad\u30b9\u30c8\u30e2\u30fc\u30c9\u3067\u6bd4\u8f03<\/td>\n<\/tr>\n<tr>\n<td align = \"center\">2<\/td>\n<td>vbDatabaseCompare<\/td>\n<td><strong>Microsoft Access<\/strong> \u306e\u5834\u5408\u306e\u307f\u6709\u52b9<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<br \/><br \/>\n<h2>Replace \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=\"Replace \u95a2\u6570\u306e\u4f7f\u7528\u4f8b\" data-url=\"http:\/\/example.co.jp\" >\r\n\r\n\u3000\r\nSub Sample_Replace()\r\n\r\n    Dim str1 As String, str2 As String, str3 As String\r\n    \r\n    str1 = \"\u30a8\u30af\u30bb\u30eb\u306f\u3001\u30de\u30a4\u30af\u30ed\u30bd\u30d5\u30c8\u304c\u3001Windows \u3084 Mac \u5411\u3051\u306b\u8ca9\u58f2\u3057\u3066\u3044\u308b\u30bd\u30d5\u30c8\u3067\u3059\u3002\" & _\r\n           \"\u30a8\u30af\u30bb\u30eb\u3092\u4f7f\u3063\u3066\u69d8\u3005\u306a\u4f5c\u696d\u3092\u884c\u3063\u3066\u3044\u307e\u3059\u3002\u30a8\u30af\u30bb\u30eb\u306e\u57fa\u672c\u64cd\u4f5c\u306f\u5fc5\u9808\u3067\u3059\u3002\"\r\n\r\n    str2 = Replace(str1, \"\u30bd\u30d5\u30c8\", \"\u30d3\u30b8\u30cd\u30b9\u30bd\u30d5\u30c8\", 16)\r\n    \r\n    str3 = Replace(str1, \"\u30a8\u30af\u30bb\u30eb\", \"\u30ef\u30fc\u30c9\", 1, 2, vbTextCompare)\r\n    \r\n    \r\n    Debug.Print str1\r\n    \r\n    Debug.Print str2\r\n    \r\n    Debug.Print str3\r\n\r\n\r\nEnd Sub\r\n\u3000\r\n\r\n<\/pre>\n<br \/>\n<h3>\u5b9f\u884c\u7d50\u679c<\/h3>\n<p><a href=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/c_replace01.jpg?ssl=1\" rel=\"lightbox[1779]\"><img loading=\"lazy\" src=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/c_replace01.jpg?resize=400%2C234&#038;ssl=1\" alt=\"Replace \u95a2\u6570 \u4f8b\" width=\"400\" height=\"234\" class=\"alignnone size-medium wp-image-1786\" srcset=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/c_replace01.jpg?resize=400%2C234&amp;ssl=1 400w, https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/c_replace01.jpg?resize=580%2C340&amp;ssl=1 580w, https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/c_replace01.jpg?w=1180&amp;ssl=1 1180w\" sizes=\"(max-width: 400px) 100vw, 400px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<br \/><\/div>\n<br \/><br \/>\n","protected":false},"excerpt":{"rendered":"<p>Replace \u95a2\u6570\u306e\u4f7f\u3044\u65b9 \u3010\u66f8\u5f0f\u3011 result = Replace ( s &#8230; <\/p>\n","protected":false},"author":1,"featured_media":1788,"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\u4e00\u90e8\u3092\u5225\u306e\u6587\u5b57\u5217\u3067\u7f6e\u63db\uff08Replace \u95a2\u6570\uff09"},"categories":[37],"tags":[210,63,38,211],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/05\/c_replace01-400x2341.jpg?fit=400%2C234&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4Ye9i-sH","_links":{"self":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/1779"}],"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=1779"}],"version-history":[{"count":7,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/1779\/revisions"}],"predecessor-version":[{"id":1787,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/1779\/revisions\/1787"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media\/1788"}],"wp:attachment":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media?parent=1779"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/categories?post=1779"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/tags?post=1779"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}