{"id":888,"date":"2020-05-07T12:28:13","date_gmt":"2020-05-07T03:28:13","guid":{"rendered":"https:\/\/auto-worker.com\/blog\/?p=888"},"modified":"2020-08-24T20:48:58","modified_gmt":"2020-08-24T11:48:58","slug":"post-888","status":"publish","type":"post","link":"https:\/\/auto-worker.com\/blog\/?p=888","title":{"rendered":"Google Apps Script\u306e\u6587\u5b57\u5217\u3067\u7a7a\u767d\u3092\u524a\u9664\u3059\u308b\u65b9\u6cd5(trim,replace)"},"content":{"rendered":"\r\n<p>Google Apps Script(GAS)\u3067\u6587\u5b57\u5217\u306b\u542b\u307e\u308c\u3066\u3044\u308b\u7a7a\u767d\u3084\u7a7a\u767d\u6587\u5b57\u3092\u9664\u53bb\u30fb\u524a\u9664\u3057\u305f\u3044\u5834\u5408\u306e\u5bfe\u5fdc\u65b9\u6cd5\u3092\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\r\n<p>trim\u30e1\u30bd\u30c3\u30c9\u3068replace\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3044\u3001GAS\u306e\u6587\u5b57\u5217\u304b\u3089\u7a7a\u767d\u3092\u53d6\u308a\u9664\u304f\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\r\n<h2>\u6587\u5b57\u5217\u306e\u7a7a\u767d\u3092\u9664\u53bb\u3059\u308b\u983b\u5ea6\u306f\u591a\u3044<\/h2>\r\n<p>Google Apps Script(GAS)\u306b\u304a\u3044\u3066\u6587\u5b57\u5217\u3092\u51e6\u7406\u3059\u308b\u6a5f\u4f1a\u306f\u591a\u304f\u3042\u308a\u307e\u3059\u3002<\/p>\r\n<p>\u3068\u308a\u308f\u3051\u6587\u5b57\u5217\u306b\u306f\u7a7a\u767d\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u983b\u5ea6\u306f\u591a\u304f\u3001\u7a7a\u767d\u3092\u542b\u3093\u3060\u307e\u307e\u51e6\u7406\u3092\u884c\u3046\u3068\u3001\u4e0a\u624b\u304f\u51e6\u7406\u3067\u304d\u306a\u3044\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\r\n<p>\u305d\u3053\u3067\u3001\u6587\u5b57\u5217\u304b\u3089\u7a7a\u767d\u3092\u9664\u53bb\u3059\u308b\u51e6\u7406\u306f\u5fc5\u8981\u306b\u306a\u3063\u3066\u304d\u307e\u3059\u3002<\/p>\r\n<h2>\u7a7a\u767d\u306b\u306f\u534a\u89d2\uff0f\u5168\u89d2\u30b9\u30da\u30fc\u30b9\u3084\u30bf\u30d6\u3001\u6539\u884c\u3082<\/h2>\r\n<p>GAS\u306e\u6587\u5b57\u5217\u306b\u542b\u307e\u308c\u308b\u7a7a\u767d\u306b\u306f\u8272\u3005\u306a\u7a2e\u985e\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\r\n<ol>\r\n<li>\u534a\u89d2\u30b9\u30da\u30fc\u30b9<\/li>\r\n<li>\u5168\u89d2\u30b9\u30da\u30fc\u30b9<\/li>\r\n<li>\u30bf\u30d6\u6587\u5b57(\\t)<\/li>\r\n<li>\u6539\u884c\u6587\u5b57(\\n)<\/li>\r\n<\/ol>\r\n<p>\u6587\u5b57\u5217\u304b\u3089\u7a7a\u767d\u3059\u308b\u969b\u306b\u306f\u3001\u30b9\u30da\u30fc\u30b9\u4ee5\u5916\u306e\u30bf\u30d6\u6587\u5b57\u3084\u6539\u884c\u6587\u5b57\u306b\u3082\u5bfe\u5fdc\u3059\u308b\u3053\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\r\n\r\n<h2>GAS\u306e\u6587\u5b57\u5217\u306e\u524d\u5f8c\u306b\u3042\u308b\u7a7a\u767d\u3092\u524a\u9664\u3059\u308b(trim\u30e1\u30bd\u30c3\u30c9)<\/h2>\r\n<p>Google Apps Script(GAS)\u306e\u6587\u5b57\u5217\u306e\u524d\u5f8c\u306b\u3042\u308b\u7a7a\u767d\u3092\u9664\u53bb\u3059\u308b\u5834\u5408\u306f\u3001trim\u30e1\u30bd\u30c3\u30c9\u3092\u7528\u3044\u307e\u3059\u3002<\/p>\r\n<p>trim\u30e1\u30bd\u30c3\u30c9\u306f\u6587\u5b57\u5217\u306e\u6587\u982d\u30fb\u6587\u672b\u306b\u3042\u308b\u534a\u89d2\uff0f\u5168\u89d2\u30b9\u30da\u30fc\u30b9\u3001\u6539\u884c\u6587\u5b57\u306a\u3069\u3092\u53d6\u308a\u9664\u3044\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-909\" src=\"https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/05\/20200507_auto_001.jpg\" alt=\"Google Apps Script(GAS)\u306e\u6587\u5b57\u5217\u306e\u524d\u5f8c\u306b\u542b\u307e\u308c\u308b\u7a7a\u767d\u3092\u524a\u9664\u30fb\u9664\u53bb\u3059\u308btrim\u30e1\u30bd\u30c3\u30c9\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\" width=\"800\" height=\"331\" srcset=\"https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/05\/20200507_auto_001.jpg 800w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/05\/20200507_auto_001-300x124.jpg 300w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/05\/20200507_auto_001-768x318.jpg 768w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/05\/20200507_auto_001-530x219.jpg 530w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/05\/20200507_auto_001-565x234.jpg 565w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/05\/20200507_auto_001-710x294.jpg 710w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/05\/20200507_auto_001-725x300.jpg 725w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\r\n<p><code>function myFunction() {<br \/>let testString =\"\\t \u3053\u308c\u306f\u3000\u7a7a\u767d\u3092\u53d6\u308a\u9664\u304f\u30c6\u30b9\u30c8\u3000\u3067\u3059\u3002\u3000\";<br \/>console.log(testString);<br \/>console.log(testString.trim());<br \/>}<\/code><\/p>\r\n<p>\u6587\u5b57\u5217\u306e\u524d\u5f8c\u306b\u8907\u6570\u306e\u7a7a\u767d\u304c\u5b58\u5728\u3057\u305f\u5834\u5408\u3082\u3001trim\u30e1\u30bd\u30c3\u30c9\u304c\u524a\u9664\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\r\n<h2>\u6587\u5b57\u5217\u306e\u4e2d\u306b\u3042\u308b\u7a7a\u767d\u3092\u524a\u9664\u3059\u308b(replace\u30e1\u30bd\u30c3\u30c9)<\/h2>\r\n<p>\u5148\u7a0b\u306etrim\u30e1\u30bd\u30c3\u30c9\u3067\u306f\u6587\u5b57\u5217\u306e\u524d\u5f8c\u306e\u7a7a\u767d\u3092\u524a\u9664\u3057\u307e\u3057\u305f\u304c\u3001\u6587\u5b57\u5217\u306e\u4e2d\u306b\u3042\u308b\u7a7a\u767d\u3092\u524a\u9664\u3057\u305f\u3044\u5834\u5408\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\r\n<p>\u305d\u3046\u3057\u305f\u5834\u5408\u306b\u306f\u3001GAS\u306b\u3042\u308breplace\u30e1\u30bd\u30c3\u30c9\u3092\u6d3b\u7528\u3057\u3066\u6587\u5b57\u5217\u5185\u306b\u3042\u308b\u7a7a\u767d\u3092\u53d6\u308a\u9664\u304d\u307e\u3059\u3002<\/p>\r\n<p>\u203breplace\u30e1\u30bd\u30c3\u30c9\u306e\u4f7f\u3044\u65b9\u306f\u3053\u3061\u3089<\/p>\r\n<p><blockquote class=\"wp-embedded-content\" data-secret=\"HnmYQ03B2q\"><a href=\"https:\/\/auto-worker.com\/blog\/?p=812\">Google Apps Script(GAS)\u3067\u6587\u5b57\u5217\u306e\u7f6e\u63db(\u7f6e\u304d\u63db\u3048)\u30fb\u524a\u9664\u3059\u308b\u65b9\u6cd5(replace\u30e1\u30bd\u30c3\u30c9)<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Google Apps Script(GAS)\u3067\u6587\u5b57\u5217\u306e\u7f6e\u63db(\u7f6e\u304d\u63db\u3048)\u30fb\u524a\u9664\u3059\u308b\u65b9\u6cd5(replace\u30e1\u30bd\u30c3\u30c9)&#8221; &#8212; AutoWorker\u301cGoogle Apps Script(GAS)\u3068Sikuli\u3067\u59cb\u3081\u308b\u696d\u52d9\u6539\u5584\u5165\u9580\" src=\"https:\/\/auto-worker.com\/blog\/?p=812&#038;embed=true#?secret=aNVvTxufr0#?secret=HnmYQ03B2q\" data-secret=\"HnmYQ03B2q\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\r\n<p>replace\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3044\u3001\u7a7a\u767d\u3092\u524a\u9664\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-910\" src=\"https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/05\/20200507_auto_002.jpg\" alt=\"Google Apps Script(GAS)\u306e\u6587\u5b57\u5217\u5185\u90e8\u306b\u542b\u307e\u308c\u3066\u3044\u308b\u7a7a\u767d\u3092\u53d6\u308a\u9664\u304freplace\u30e1\u30bd\u30c3\u30c9\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\" width=\"800\" height=\"407\" srcset=\"https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/05\/20200507_auto_002.jpg 800w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/05\/20200507_auto_002-300x153.jpg 300w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/05\/20200507_auto_002-768x391.jpg 768w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/05\/20200507_auto_002-530x270.jpg 530w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/05\/20200507_auto_002-565x287.jpg 565w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/05\/20200507_auto_002-710x361.jpg 710w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/05\/20200507_auto_002-725x369.jpg 725w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/>\u00a0<\/p>\r\n<p><code>function myFunction() {<br \/>let testString =\"\u3053\u308c\u306f\\n\u7a7a\u767d\u3092\u53d6\u308a\u9664\u304f\u30c6\u30b9\u30c8\u3000\u3067\u3059\u3002\";<br \/>console.log(testString);<br \/>\/\/\u6587\u5b57\u5217\u306e\u4e2d\u306b\u542b\u307e\u308c\u308b\u7a7a\u767d\u3092\u524a\u9664\u3059\u308b<br \/>testString = testString.replace(\"\u3000\",\"\");<br \/>console.log(testString);<br \/>}<\/code><\/p>\r\n<p>\u3053\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u6587\u5b57\u5217\u306b\u3042\u308b\u7a7a\u767d\u3092\u9664\u53bb\u3067\u304d\u307e\u3059\u3002<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-911\" src=\"https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/05\/20200507_auto_003.jpg\" alt=\"GAS\u306ereplace\u30e1\u30bd\u30c3\u30c9\u3092\u5b9f\u884c\u3057\u305f\u30ed\u30b0\u51fa\u529b\u306e\u7d50\u679c\" width=\"600\" height=\"136\" srcset=\"https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/05\/20200507_auto_003.jpg 600w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/05\/20200507_auto_003-300x68.jpg 300w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/05\/20200507_auto_003-530x120.jpg 530w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/05\/20200507_auto_003-565x128.jpg 565w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\r\n<p>replace\u30e1\u30bd\u30c3\u30c9\u306e\u7b2c\u4e00\u5f15\u6570\u3067\u6307\u5b9a\u3059\u308b\u3082\u306e\u3092\u3001\u30bf\u30d6\u6587\u5b57(\\t)\u3084\u6539\u884c\u6587\u5b57(\\n)\u306b\u6307\u5b9a\u3059\u308b\u3068\u3001\u305d\u308c\u3089\u3092\u524a\u9664\u53ef\u80fd\u3067\u3059\u3002<\/p>\r\n<h2>GAS\u3067\u8907\u6570\u306e\u7a7a\u767d\u3092\u524a\u9664\u3057\u305f\u3044\u5834\u5408\u306f\uff1f<\/h2>\r\n<p>\u306a\u304a\u3001\u5148\u7a0b\u306ereplace\u30e1\u30bd\u30c3\u30c9\u3067\u306f\u3001\u7a7a\u767d\u306f1\u7b87\u6240\u3057\u304b\u524a\u9664\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\r\n<p>\u8907\u6570\u7b87\u6240\u306e\u7a7a\u767d\u3092\u524a\u9664\u3059\u308b\u5834\u5408\u306f\u3001replace\u30e1\u30bd\u30c3\u30c9\u306e\u5f15\u6570\u3092\u6b63\u898f\u8868\u73fe\u3092\u7528\u3044\u305f\u5f62\u3067\u5de5\u592b\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\r\n<p><code>function myFunction() {<br \/>let testString =\"\u3053\u308c\u306f\\n\u7a7a\u767d\u3092\u53d6\u308a\u9664\u304f\u30c6\u30b9\u30c8\u3000\u3067\u3059\u3002\";<br \/>console.log(testString);<br \/><strong>\/\/\u6587\u5b57\u5217\u306e\u4e2d\u306b\u542b\u307e\u308c\u308b\u7a7a\u767d\u3092\u524a\u9664\u3059\u308b<\/strong><br \/><strong>testString = testString.replace(<span style=\"color: #ff0000;\">\/\u3000\/g<\/span>,\"\");<\/strong><br \/>console.log(testString);<br \/>}<\/code><\/p>\r\n<p>\u6b63\u898f\u8868\u73fe\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u30d5\u30e9\u30b0\u300cg\u300d\u3092\u7528\u3044\u308b\u3053\u3068\u3067\u3001\u8907\u6570\u306e\u7a7a\u767d\u3092\u524a\u9664\u3067\u304d\u307e\u3059\u3002<\/p>\r\n<p>\u3055\u3089\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u6b63\u898f\u8868\u73fe\u3092\u8a18\u8ff0\u3059\u308b\u3053\u3068\u3067\u3001\u534a\u89d2\uff0f\u5168\u89d2\u30b9\u30da\u30fc\u30b9\u3084\u6539\u884c\u6587\u5b57\u3001\u30bf\u30d6\u6587\u5b57\u3068\u3042\u3089\u3086\u308b\u7a7a\u767d\u3092\u4e00\u62ec\u3067\u524a\u9664\u3067\u304d\u307e\u3059\u3002<\/p>\r\n<p><code><strong>String.replace(\/[\\s\\t\\n]\/g,\"\");<\/strong><\/code><\/p>\r\n<h2>\u307e\u3068\u3081\u30fb\u7d42\u308f\u308a\u306b<\/h2>\r\n<p>\u4eca\u56de\u3001Google Apps Script(GAS)\u306e\u6587\u5b57\u5217\u304b\u3089\u7a7a\u767d\u3092\u524a\u9664\u30fb\u9664\u53bb\u3059\u308b\u65b9\u6cd5\u3092\u89e3\u8aac\u3057\u307e\u3057\u305f\u3002<\/p>\r\n<p>\u6587\u5b57\u5217\u306e\u524d\u5f8c\u306b\u7a7a\u767d\u304c\u542b\u307e\u308c\u308b\u5834\u5408\u306f\u3001trim\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3044\u3001\u305d\u306e\u4ed6\u306e\u6587\u5b57\u5217\u5185\u306b\u3042\u308b\u7a7a\u767d\u3092\u53d6\u308a\u9664\u304f\u5834\u5408\u306freplace\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\r\n<p>replace\u30e1\u30bd\u30c3\u30c9\u306b\u6b63\u898f\u8868\u73fe\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u534a\u89d2\uff0f\u5168\u89d2\u30b9\u30da\u30fc\u30b9\u4ee5\u5916\u306e\u30bf\u30d6\u6587\u5b57\u3084\u6539\u884c\u6587\u5b57\u306a\u3069\u3042\u3089\u3086\u308b\u7a7a\u767d\u6587\u5b57\u306e\u524a\u9664\u306b\u5bfe\u5fdc\u3067\u304d\u307e\u3059\u3002<\/p>\r\n<p>\u7a7a\u767d\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u3068\u6587\u5b57\u5217\u306e\u51e6\u7406\u304c\u4e0a\u624b\u304f\u3044\u304b\u306a\u3044\u5834\u5408\u306f\u3001\u4eca\u56de\u7d39\u4ecb\u3057\u305f\u7a7a\u767d\u3092\u524a\u9664\u3059\u308b\u65b9\u6cd5\u3092\u5229\u7528\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>","protected":false},"excerpt":{"rendered":"<p>Google Apps Script(GAS)\u3067\u6587\u5b57\u5217\u306b\u542b\u307e\u308c\u3066\u3044\u308b\u7a7a\u767d\u3084\u7a7a\u767d\u6587\u5b57\u3092\u9664\u53bb\u30fb\u524a\u9664\u3057\u305f\u3044\u5834\u5408\u306e\u5bfe\u5fdc\u65b9\u6cd5\u3092\u89e3\u8aac\u3057\u307e\u3059\u3002 trim\u30e1\u30bd\u30c3\u30c9\u3068replace\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3044\u3001GAS\u306e\u6587\u5b57\u5217\u304b\u3089\u7a7a\u767d\u3092\u53d6\u308a\u9664\u304f\u65b9\u6cd5\u3092\u7d39\u4ecb [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":912,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[14,280,279,179,278,281],"class_list":["post-888","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-gas","tag-gas","tag-replace","tag-trim","tag-179","tag-278","tag-281"],"_links":{"self":[{"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/888","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=888"}],"version-history":[{"count":2,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/888\/revisions"}],"predecessor-version":[{"id":913,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/888\/revisions\/913"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/media\/912"}],"wp:attachment":[{"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=888"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=888"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=888"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}