Skip to content

Commit

Permalink
refactor and deprecate Repeat
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Jan 30, 2015
1 parent febcb48 commit 7635dd7
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions library/types/src/modules/String.rb
Expand Up @@ -340,17 +340,11 @@ def CutZeros(input)
# @param input string to repeat
# @param input number number of repetitions
# @return [String] repeated string
# @deprecated use {::String#operator*} instead
def Repeat(text, number)
text = "" if text.nil?

ret = ""
return "" if text.nil? || number.nil? || number < 1

while Ops.greater_than(number, 0)
ret = Ops.add(ret, text)
number = Ops.subtract(number, 1)
end

ret
text * number
end

# Add the padding character around the text to make it long enough
Expand Down

0 comments on commit 7635dd7

Please sign in to comment.