Skip to content

End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

String#to_str

to_str

Alias of #to_s

Returns self if self is a String, or self converted to a String if self is a subclass of String.

String#to_str is an alias for String#to_s.

See also #to_s #tosjis #to_sym #toutf16 also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0