This is a Ruby tree! It shows every object from the Ruby Programming Language in a tree format.

sub

        # String.sub

(from ruby core)
---
    sub(pattern, replacement)   -> new_string
    sub(pattern) {|match| ... } -> new_string

---

Returns a copy of `self` with only the first occurrence (not all
occurrences) of the given `pattern` replaced.

See [Substitution Methods](#class-String-label-Substitution+Methods).

Related: String#sub!, String#gsub, String#gsub!.



      

This is MURDOC! A Ruby documentation browser inspired by Smalltalk-80. It allows you to learn about Ruby by browsing through its class hierarchies, and see any of its methods.