{"id":1424,"date":"2009-07-23T02:43:28","date_gmt":"2009-07-22T17:43:28","guid":{"rendered":"http:\/\/fukata.org\/?p=1424"},"modified":"2017-08-11T23:07:14","modified_gmt":"2017-08-11T23:07:14","slug":"jc-add-comment-and-js-trim","status":"publish","type":"post","link":"https:\/\/blog.fukata.org\/archives\/1424\/","title":{"rendered":"[JC]\u30b3\u30e1\u30f3\u30c8\u6295\u7a3f\u6a5f\u80fd\u8ffd\u52a0\u3068JS\u3067trim\u30e1\u30bd\u30c3\u30c9"},"content":{"rendered":"

\"ArticleDetail_1248284312768\"<\/a>\u3084\u3063\u3068\u30b3\u30e1\u30f3\u30c8\u6295\u7a3f\u6a5f\u80fd\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f\u3002<\/p>\n

\u305d\u3057\u3066\u3001\u305d\u306e\u969b\u3001\u7a7a\u767d\u30b3\u30e1\u30f3\u30c8\u3084\u3001\u6539\u884c\u3057\u304b\u306a\u3044\u30b3\u30e1\u30f3\u30c8\u306e\u5834\u5408\u306bJS\u3067\u30a8\u30e9\u30fc\u3092\u51fa\u3059\u3088\u3046\u306b\u3057\u3066\u307f\u305f\u306e\u3067\u3059\u304c\u3001\u305d\u306e\u969b\u4f5c\u6210\u3057\u305ftrim\u30e1\u30bd\u30c3\u30c9\u306e\u30b3\u30fc\u30c9\u3092\u516c\u958b\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u307e\u3041\u3001\u3068\u8a00\u3063\u3066\u3082\u7c21\u5358\u306a\u6b63\u898f\u8868\u73fe\u3092\u7e70\u308a\u66ff\u3048\u3057\u3066\u3044\u308b\u3060\u3051\u306a\u3093\u3067\u3059\u3051\u3069\u306d\uff3e\uff3e\uff1b<\/p>\n

\u6b63\u898f\u8868\u73fe\u3092\u8003\u3048\u308b\u306e\u304c\u3060\u308b\u304b\u3063\u305f\u306e\u3067\u3001\u30d1\u30ef\u30fc\u30b3\u30fc\u30c9\u306b\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u5229\u7528\u3059\u308b\u969b\u306f\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n

\u25a0string.js<\/p>\n

\r\nString.prototype.trim = function() {\r\n\tvar _str = this;\r\n\tvar length = 0;\r\n\tdo {\r\n\t\tlength = _str.length;\r\n\t\t\/\/ \u5148\u982d\u3001\u672b\u5c3e\u306e\u534a\u89d2\u7a7a\u767d\u6587\u5b57\u306e\u524a\u9664\r\n\t\t_str = _str.replace(\/^[ ]+|[ ]+$\/g, '');\r\n\t\t\/\/ \u5148\u982d\u3001\u672b\u5c3e\u306e\u5168\u89d2\u7a7a\u767d\u6587\u5b57\u306e\u524a\u9664\r\n\t\t_str = _str.replace(\/^[\u3000]+|[\u3000]+$\/g, '');\r\n\t\t\/\/ \u5148\u982d\u3001\u672b\u5c3e\u306e\u6539\u884c\u30b3\u30fc\u30c9\u306e\u524a\u9664\r\n\t\t_str = _str.replace(\/^[\\r\\n]+|[\\r\\n]+$\/g, '');\r\n\t} while (length!=_str.length)\r\n\t\r\n\treturn _str;\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"

\u3084\u3063\u3068\u30b3\u30e1\u30f3\u30c8\u6295\u7a3f\u6a5f\u80fd\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f\u3002 \u305d\u3057\u3066\u3001\u305d\u306e\u969b\u3001\u7a7a\u767d\u30b3\u30e1\u30f3\u30c8\u3084\u3001\u6539\u884c\u3057\u304b\u306a\u3044\u30b3\u30e1\u30f3\u30c8\u306e\u5834\u5408\u306bJS\u3067\u30a8\u30e9\u30fc\u3092\u51fa\u3059\u3088\u3046\u306b\u3057\u3066\u307f\u305f\u306e\u3067\u3059\u304c\u3001\u305d\u306e\u969b\u4f5c\u6210\u3057\u305ftrim\u30e1\u30bd\u30c3\u30c9\u306e\u30b3\u30fc\u30c9\u3092\u516c\u958b\u3057\u305f\u3044\u3068\u601d\u3044\u307e … \u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":2,"featured_media":9223372036854775807,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1980],"tags":[341,354],"_links":{"self":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/posts\/1424"}],"collection":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/comments?post=1424"}],"version-history":[{"count":0,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/posts\/1424\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/media\/9223372036854775807"}],"wp:attachment":[{"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/media?parent=1424"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/categories?post=1424"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.fukata.org\/wp-json\/wp\/v2\/tags?post=1424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}