假设我在一个名为“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
),但我不确定如何将单换行符更改为双换行符。我会通过正则表达式怀疑某些东西,但我不知道从哪里开始。