< :前の番号
^ :番号順リスト
> :次の番号
P :前の記事(スレッド移動)
N :次の記事(スレッド移動)
|<:前のスレッド
>|:次のスレッド
^ :返事先
_:自分への返事
>:同じ返事先を持つ記事(前)
<:同じ返事先を持つ記事(後)
---:分割してスレッド表示、再表示
| :分割して(縦)スレッド表示、再表示
~ :スレッドのフレーム消去
.:インデックス
..:インデックスのインデックス
Issue #14022 has been updated by avit (Andrew Vit).
An alternate (short but cryptic) way:
```
str = "one\ntwo"
str.gsub(/^.*/m, '<\0>')
```
- gsub! can do it destructively
- using `/m` can control if it wraps each line, or all
(A similar usage for wrapping characters in a string is shown in the String#gsub documentation)
Out of curiosity, can someone explain why the `^` is needed in my regex?
----------------------------------------
Feature #14022: String#surround
https://bugs.ruby-lang.org/issues/14022#change-67367
* Author: sawa (Tsuyoshi Sawada)
* Status: Open
* 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: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>