6 ruby
我想使用变量insite%w {}但这只生成字符串.
我试过了
a="hello",
b="world"
%w{a b}
Run Code Online (Sandbox Code Playgroud)
但这是显示 ["a", "b"]我要显示["你好","世界"]
Pau*_*l.s 15
如果要使用变量,可以使用插值和%W变量
a = "hello"
b = "world"
pp %W{#{a} #{b} this is normal text} #=> ["hello", "world", "this", "is", "normal", "text"]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2847 次 |
| 最近记录: |