我有以下一组哈希,
hash_One = {" RESPONSE_TEXT_CONTENT_TYPE "=>" 'responseTextContentType'"}{" CURRENT_USER_ID "=>" 'careUserId'"}{" RESPOSNSE_KEY "=>" 'responseKey'"}
在此,我必须删除所有那些不必要的引号和空格,我需要将hash_One转换为一个哈希。如下所示,
hash_One = {"RESPONSE_TEXT_CONTENT_TYPE" => responseTextContentType,
"CURRENT_USER_ID" => careUserId
"RESPOSNSE_KEY" => responseKey}
我可以采取什么方式
您的意思是这样的?
RESPONSE_TEXT_CONTENT_TYPE = 20
RESPOSNSE_KEY = 5
test = 10
x = 5
arr1 = [RESPONSE_TEXT_CONTENT_TYPE,test,RESPOSNSE_KEY,x]
arr2 = [test,x,'local',123,RESPONSE_TEXT_CONTENT_TYPE]
arr3 = arr1 & arr2
puts arr3.inspect