我有两个资料表
分别是
array1 = [ x= 'blue', 'y'='car' ] array2 = [ x= 'blue', 'y'='book' ] array3 = [ x= 'blue', 'y'='pen' ] array0 = [ x= 'blue', 'y'='car, house, egg, book, ,pen' ]
想要的结果是
arraywant = [ x= 'blue', 'y'=' house, egg']
请指点指点
你这里的 array 既不是 ruby 的数组也不是 hash 啊。我的大概思路:
ary=array0['y'].split ',' ary.delete array1['y'] if ary.inclued? array1['y'] ary.delete array2['y'] if ary.inclued? array2['y'] ary.delete array3['y'] if ary.inclued? array3['y'] arraywant={:x=>array0[:x],'y'=>ary.join(',')}