Skip to content

Commit

Permalink
Allow numbers to be print with %s,%S
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.codehaus.org/jruby/trunk/jruby@1847 961051c9-f516-0410-bf72-c9f7e237a7b7
  • Loading branch information
enebo committed Dec 22, 2005
1 parent 415b1e0 commit 0b86fcc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/org/jruby/util/PrintfFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Copyright (C) 2004 Anders Bengtsson <ndrsbngtssn@yahoo.se>
* Copyright (C) 2004 Thomas E Enebo <enebo@acm.org>
* Copyright (C) 2004 Stefan Matthias Aust <sma@3plus4.de>
* Copyright (C) 2005 Derek Berner <derek.berner@state.nm.us>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
Expand Down Expand Up @@ -574,6 +575,10 @@ String internalsprintf(int s) throws IllegalArgumentException {
case 'C' :
s2 = printCFormat((char) s);
break;
case 's':
case 'S':
s2 = printSFormat(String.valueOf(s));
break;
default :
throw new IllegalArgumentException("Cannot format a int with a format using a " + conversionCharacter + " conversion character.");
}
Expand Down Expand Up @@ -617,7 +622,8 @@ String internalsprintf(long s) throws IllegalArgumentException {
s2 = printCFormat((char) s);
break;
case 's' :
s2 = printSFormat(String.valueOf(s));
case 'S' :
s2 = printSFormat(String.valueOf(s));
break;
case 'b' :
s2 = printBFormat(s);
Expand Down Expand Up @@ -653,6 +659,10 @@ String internalsprintf(double s) throws IllegalArgumentException {
case 'g' :
s2 = printGFormat(s);
break;
case 's':
case 'S':
s2 = printSFormat(String.valueOf(s));
break;
default :
throw new IllegalArgumentException("Cannot format a double with a format using a " + conversionCharacter + " conversion character.");
}
Expand Down

0 comments on commit 0b86fcc

Please sign in to comment.