Converting a Symbol to String

suggest change

Given a Symbol:

s = :something

The simplest way to convert it to a String is by using the Symbol#to_s method:

s.to_s
# => "something"

Another way to do it is by using the Symbol#id2name method which is an alias for the Symbol#to_s method. But it’s a method that is unique to the Symbol class:

s.id2name
# => "something"

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents