diff --git a/src/string.cr b/src/string.cr index 5868ae16fc2a..a1c7aaea8def 100644 --- a/src/string.cr +++ b/src/string.cr @@ -4054,7 +4054,10 @@ class String # Interpolates *other* into the string using `Kernel#sprintf`. # # ``` - # "Party like it's %d!!!" % 1999 # => "Party like it's 1999!!!" + # "I have %d apples" % 5 # => "I have 5 apples" + # "%s, %s, %s, D" % ['A', 'B', 'C'] # => "A, B, C, D" + # "sum: %{one} + %{two} = %{three}" % {one: 1, two: 2, three: 1 + 2} # => "sum: 1 + 2 = 3" + # "I have %s apples" % {apples: 4} # => "I have 4 apples" # ``` def %(other) sprintf self, other