Order disjoint list items: Difference between revisions
Content added Content deleted
m (→sprintf version: space) |
m (→sprintf version: Add comment) |
||
Line 2,176: | Line 2,176: | ||
nn = n.split |
nn = n.split |
||
nn.each {|item| mm.sub!(item, "%s")} #sub! only subs the first match |
nn.each {|item| mm.sub!(item, "%s")} #sub! only subs the first match |
||
mm % nn #"the %s sat on the %s" % [mat", "cat"] #does what you hope it does. |
|||
mm % nn |
|||
end |
end |
||