Skip to main content
Say What???
Ain't got a slogan...

Main menu

  • Home
  • Archived Articles

You are here

Home » Ruby 1.8 Method of the Day Archive

String.*

Kelly McCauley's picture
published by Kelly McCauley on Wed, 10/27/2010 - 06:40

Signature

string * positive_integer   #=> new_string

string.* returns a new string that is composed of positive_integer copies of string.

Examples

"x" * 5         #=> "xxxxx"
"x".*(5)        #=> "xxxxx"
"x" * 0         #=> ""

# * will not accept a negative integer
y = 'foo'
begin
  y * -2
rescue Exception => e
  e.inspect     #=> #
end

Documentation Reference

www.ruby-doc.org : String.*

‹ String.% up String.+ ›
  • Log in to post comments

Ruby 1.8 Method of the Day Archive

  • Array.&
  • Array.+
  • Array.-
  • Array.<< and Array.push
  • Array.[] and Array.slice
  • Array.[]=
  • Array.abbrev
  • Array.assoc
  • Array.compact and Array.compact!
  • Array.delete
  • Array.delete_if
  • Array.fetch
  • Array.first
  • Array.last
  • Array.map and Array.collect
  • Array.map! and Array.collect!
  • Array.nitems
  • Array.pop
  • Array.rassoc
  • Array.reject
  • Array.reject!
  • Array.slice!
  • Float.ceil
  • Float.floor
  • Float.truncate
  • Integer.downto
  • Integer.times
  • Integer.upto
  • String.%
  • String.*
  • String.+
  • String.<=>
  • String.==
  • String.=~
  • String.[]
  • String.[]=
  • String.casecmp
  • String.center
  • String.count
  • String.delete
  • String.delete!
  • String.gsub
  • String.gsub!
  • String.hex
  • String.index
  • String.insert
  • String.inspect
  • String.length
  • String.ljust
  • String.lstrip
  • String.lstrip!
  • String.next
  • String.reverse
  • String.rindex
  • String.rjust
  • String.rstrip
  • String.rstrip!
  • String.scan
  • String.strip
  • String.strip!
  • String.sub
  • String.to_sym

User login

  • Request new password

Syndicate

Subscribe to Syndicate

Content Copyright © Kelly McCauley, All Rights Reserved. Trademarks and copyrights are owned by their respective owners. Comments are owned by the commenter.