From: Ben Bleything Date: 2010-02-15T03:33:56+09:00 Subject: Re: toutf8 On Sun, Feb 14, 2010 at 9:58 AM, Raul Jara wrote: > The string class has a couple of methods listed in ruby-doc such as: > > String#toutf8 → string > > or > > String#tosjis → string > > That's diferent than how they list most of the other methods, e.g.: > > str.strip => new_str > > I'm afraid I have no idea how to call a method like toutf8.  I don't > know what's up with # sign, either.  Anyone willing to explain this to a > novice like me? Sure :) The hash notation is used to indicate an instance method. In this case, #toutf8 is a method that returns a string. The "str.strip => new_str" form is showing the same thing, but by way of example. It's just an inconsistency in the docs. We use a hash to signify instance methods because you call class methods with a .: String.new String#split the first is referring to the 'new' method on class String, the second is referring to the instance method 'split' on strings. So, to call a method that is documented as Class#method, you would create an instance of that class and then call it in the normal way. In this case, you'd do: "some string goes here".toutf8 Ben