「tao」というファイルにこれがあるとしましょう:
If you can talk about it, it ain't Tao. If it has a name, it's just another thing.
Tao doesn't have a name. Names are for ordinary things.
そして、それをルビーで開き、次のように変更したいと思います。
If you can talk about it, it ain't Tao. If it has a name, it's just another thing.
Tao doesn't have a name. Names are for ordinary things.
ファイルを読み取り、内容を文字列に変換する方法は知っていますが (これを と呼びましょうtao_string
)、単一の改行を二重の改行に変更する方法がわかりません。正規表現を介して何かを疑っていますが、どこから始めればよいかわかりません。