gpt4 book ai didi

ruby - 在 Ruby 中用字符串连接双引号

转载 作者:数据小太阳 更新时间:2023-10-29 07:20:17 25 4
gpt4 key购买 nike

我需要一个带双引号的字符串

尝试过

expectedValue = "/""+expectedValue+"/""

但没用-

抛出以下错误-

NoMethodError: undefined method `/' for "/+expectedValue+":String

请提出建议。

最佳答案

可能你的意思是:

expectedValue = "\""+expectedValue+"\""

或更多 ruby 风格:

expectedValue = "\"#{expectedValue}\""

关于ruby - 在 Ruby 中用字符串连接双引号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24286867/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com