Ruby Method of the Day - String.*
Signature
string * positive_integer #=> new_stringstring.* returns a new string that is composed of
positive_integer copies of string.
Examples
1 2 3 4 5 6 7 8 9 10 11 |
"x" * 5 #=> "xxxxx" "x".*(5) #=> "xxxxx" "x" * 0 #=> "" # * will not accept a negative integer y = 'foo' begin y * -2 rescue Exception => e e.inspect #=> #<ArgumentError: negative argument> end |
