From: her@... Date: 2018-03-15T08:14:03+00:00 Subject: [ruby-core:86137] [Ruby trunk Feature#14022][Feedback] String#surround Issue #14022 has been updated by sorah (Sorah Fukumori). Status changed from Open to Feedback It appears like `yield_self` or `%s` formatting can satisfy the use cases noted here. Changing this ticket to Feedback for now. @sawa, could you update your opinion by taking a look into this discussion? ---------------------------------------- Feature #14022: String#surround https://bugs.ruby-lang.org/issues/14022#change-71012 * Author: sawa (Tsuyoshi Sawada) * Status: Feedback * Priority: Normal * Assignee: * Target version: ---------------------------------------- After joining the elements of an array into a string using `Array#join`, I frequently need to put substrings before and after the string. In such case, I would have to use either of the following: ```ruby [1, 2, 3].join(", ").prepend("<").concat(">") # => "<1, 2, 3>" "<#{[1, 2, 3].join(", ")}>" # => "<1, 2, 3>" "<" + [1, 2, 3].join(", ") + ">" # => "<1, 2, 3>" ``` but none of them is concise enough. I wish there were `String#surround` that works like this: ```ruby [1, 2, 3].join(", ").surround("<", ">") # => "<1, 2, 3>" ``` -- https://bugs.ruby-lang.org/ Unsubscribe: