0
我需要幫助來連接2個瓦爾成1個VAR或使用該瓦爾在一起的任何其他方法...如何連接這在Ruby中
我的目的是讓藝術ASCII碼發生器需要的地方展示一個特定的詞來產生它...在這個例子中,我只會顯示單詞「a」,但我不能,打印功能打印變量「([0,4])」的內容,我需要連接的VAR和處理它像一個命令,而不是像一個字符串...:
# encoding:utf-8
threexfive = '
# # ##
## ### ### ### ### # ###
# # # # # # # ## ### # #
### ### ### ### ### # ##
## ###
'
# The long of the letters a to f
threexfive_longs = '
a=[0,4]
b=[4,4]
c=[8,4]
d=[12,4]
e=[16,4]
f=[20,4]
'
string = ''
word = 'a'
word.each_char do |char|
$long = threexfive_longs.split(char).last.split(']').first.split('=').last + "]"
threexfive.each_line do |type|
# This don't works:
string = type + $long
print string
# But this works :(
# print type[20,4], type[0,4], type[8,4], type[16,4], "\n"
end
end
這裏的區別是:
# This doesn't work:
string = type + $long
print string
輸出:
# But this works :(
print type[0,4], "\n"
輸出:
三江源這麼多!現在我可以繼續與你的幫助 – ElektroStudios 2012-03-25 16:11:48
@ user1248295然後你應該標記這個答案爲接受,投票箭頭下方的小勾號標記。 – 2012-03-25 17:18:41
對不起,我不知道。 thx再次 – ElektroStudios 2012-03-25 21:51:22