Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想将变量中的十六进制字符串值转换为 int。
这适用于文字:"#{0xFF}".to_i
"#{0xFF}".to_i
但是有一个 var ...?
不工作测试(插值错误):
_myvar = "FF" "#{0x_myvar}".to_i
为什么不查看String 的 API 文档
"FF".to_i(16)