【发布时间】:2017-08-14 10:02:00
【问题描述】:
在 Ruby 中,我正在尝试将字符串转换为哈希值。它在字符串中显示为转义字符和“\n”。
例如:
hashex = { keyex: 'example "test" line 1
line 2 "test2"'}
puts hashex
将结果打印为
{:keyex=>"example \"test\" line 1\n line 2 \"test2\""}
我需要得到结果
{ keyex: 'example "test" line 1
line 2 "test2"'}
保留换行符(不是'\n')和“”。请帮忙。
【问题讨论】: