APIdock / Ruby
/
Browse About
method

to_str

ruby latest stable - Class: String
to_str()
public

Returns self.

If called on a subclass of String, converts the receiver to a String object.

static VALUE
rb_str_to_s(VALUE str)
{
    if (rb_obj_class(str) != rb_cString) {
        return str_duplicate(rb_cString, str);
    }
    return str;
}

Related methods

  • Instance methods
  • %
  • *
  • +
  • +@
  • -@
  • <<
  • <=>
  • ==
  • ===
  • =~
  • []
  • []=
  • ascii_only?
  • b
  • block_scanf
  • bytes
  • bytesize
  • byteslice
  • capitalize
  • capitalize!
  • casecmp
  • casecmp?
  • center
  • chars
  • chomp
  • chomp!
  • chop
  • chop!
  • chr
  • clear
  • codepoints
  • concat
  • count
  • crypt
  • delete
  • delete!
  • delete_prefix
  • delete_prefix!
  • delete_suffix
  • delete_suffix!
  • downcase
  • downcase!
  • dump
  • each_byte
  • each_char
  • each_codepoint
  • each_grapheme_cluster
  • each_line
  • empty?
  • encode
  • encode!
  • encoding
  • end_with?
  • eql?
  • force_encoding
  • freeze
  • getbyte
  • grapheme_clusters
  • gsub
  • gsub!
  • hash
  • hex
  • include?
  • index
  • initialize_copy
  • insert
  • inspect
  • intern
  • iseuc
  • isjis
  • issjis
  • isutf8
  • kconv
  • length
  • lines
  • ljust
  • lstrip
  • lstrip!
  • match
  • match?
  • next
  • next!
  • oct
  • ord
  • parse_csv
  • partition
  • prepend
  • pretty_print
  • replace
  • reverse
  • reverse!
  • rindex