{"url":"https://babie.hatenablog.com/entry/20050917/p2","published":"2005-09-17 00:00:01","provider_name":"Hatena Blog","blog_url":"https://babie.hatenablog.com/","author_url":"https://blog.hatena.ne.jp/babie/","blog_title":"babie, you're my home","height":"190","author_name":"babie","type":"rich","description":"\u306a\u3093\u304b\u6c17\u306b\u98df\u308f\u306a\u3044\u3002Ruby \u3063\u307d\u304f\u306a\u3044\u3088\u3046\u306a\u6c17\u304c\u3059\u308b\u3002 p sprintf(\"%05d\", 123)C\u8a00\u8a9e\u3063\u307d\u3044\u306d\u3002 p \"%05d\" % 123\u3053\u308c\u306f\u307e\u3041\u307e\u3041\u3002\u3051\u3069\u3001\u3044\u3061\u3052\u3093\u3055\u3093\u3067\u306f\u8aad\u3081\u306a\u3044\u3002 String#sprintf \u3068\u304b\u3042\u3063\u305f\u3089\u826f\u3044\u3068\u601d\u3046\u306e\u3060\u304c\u3069\u3046\u304b\uff1f class String def sprintf(*args) Kernel.sprintf(self, *args) end end p \"%05d\".sprintf(123) Integer#to_s(n) \u304c n\u9032\u6570\u6587\u5b57\u5217\u3092\u4f5c\u3063\u3066\u304f\u308c\u308b\u304c\u3001\u4f3c\u305f\u3088\u3046\u306a\u306e\u304c\u3042\u308b\u3068\u5b09\u3057\u3044\u3002 class Integer def format(str)\u2026","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fbabie.hatenablog.com%2Fentry%2F20050917%2Fp2\" title=\" sprintf - babie, you&#39;re my home\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","version":"1.0","title":" sprintf","provider_url":"https://hatena.blog","image_url":null,"width":"100%","categories":["Ruby"]}