MastroLube 发表于 2022-7-5 18:25:13

将字符串转换为变量

大家好,我有一个简单的问题要问你们
我需要将字符串转换为变量名。
(nth i (strcat "I_" pippo))
其中pippo为“100”
I_100是一个列表的名称
 
感谢
 
(得到答案)
 
(nth i (eval (read (strcat "I_" pippo))))

David Bethel 发表于 2022-7-5 19:17:33

如果要绑定变量,请记住使用(set)代替(setq)
 

(set (read (strcat "I_" pippo)))

 
 
玩得开心-大卫

MastroLube 发表于 2022-7-5 19:26:13

谢谢现在我知道了setq和set之间的区别)
页: [1]
查看完整版本: 将字符串转换为变量