Skip to content

Commit

Permalink
Improve documentation of String#% (#6095)
Browse files Browse the repository at this point in the history
  • Loading branch information
wooster0 authored and sdogruyol committed May 17, 2018
1 parent 07c7066 commit 645afb0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/string.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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 %<apples>s apples" % {apples: 4} # => "I have 4 apples"
# ```
def %(other)
sprintf self, other
Expand Down

0 comments on commit 645afb0

Please sign in to comment.