Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed the bug of sprintf with format like a "%010.4u".

Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions

assert_equal("      000000000000000000000123", sprintf("%030.24u", 123))
assert_equal("     -000000000000000000000123", sprintf("%030.24u", -123))

puts :ok
}}}

git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@5173 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information...
commit 32b2e40c390520197115ac741d8c662be2f6cdf7 1 parent eaf4b4a
@Watson1978 Watson1978 authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 sprintf.c
View
5 sprintf.c
@@ -624,8 +624,11 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
case 'u':
case 'U':
base = 10;
- complete = true;
sharp_flag = false;
+ if (precision_flag) {
+ zero_flag = false;
+ }
+ complete = true;
break;
case 'x':
Please sign in to comment.
Something went wrong with that request. Please try again.