Mega Code Archive

 
Categories / Ruby / String
 

Adds provided string to front of self

class String    def unshift_word(other)     newself = other.to_s + self     self.replace(newself)   end end a = "this is a test" puts a.unshift_word "another"