Skip to content

Commit

Permalink
rubify format two digits
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Feb 5, 2015
1 parent d1ce57d commit d8eda02
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions library/types/src/modules/String.rb
Expand Up @@ -218,11 +218,8 @@ def FormatRateMessage(text, avg_bps, curr_bps)
# @return [String] number as two-digit string
#
def FormatTwoDigits(x)
if Ops.less_than(x, 10) && Ops.greater_or_equal(x, 0)
Builtins.sformat("0%1", x)
else
Builtins.sformat("%1", x)
end
msg = (0..10).member?(x) ? "0%1" : "%1"

This comment has been minimized.

Copy link
@ancorgs

ancorgs Feb 10, 2015

Contributor

Wouldn't it be (0..9)?

This comment has been minimized.

Copy link
@jreidinger

jreidinger Feb 10, 2015

Author Member

ah, you are right, I add testcase for this corner case :)

Builtins.sformat(msg, x)
end

# Format an integer seconds value with min:sec or hours:min:sec
Expand Down

0 comments on commit d8eda02

Please sign in to comment.