Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7709369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:50:39+00:00 2026-06-01T00:50:39+00:00

I need help to concatenate 2 vars into 1 var, or any other method

  • 0

I need help to concatenate 2 vars into 1 var, or any other method to use that vars together…

My intention is to make a art ascii generator where it needs to show a specific word to generate it… in this example i only will to show the word “a”, but i can’t, the print funciont prints the content of the var “([0,4])“, i need to concatenate the vars and process it like a command, not like a string… :

# 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

Here is the difference:

   # This doesn't work:
   string = type + $long
   print string

Output:

Output

   # But this works  :(
   print type[0,4], "\n"

Output:

Output

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T00:50:41+00:00Added an answer on June 1, 2026 at 12:50 am

    You can try to compose all the lines individually and then concatenate them with join("\n") like in the following example. I strongly recommend using a proper data structure for the char positions (or “longs” as you called them). In this example, i have used a hash.

    # encoding:utf-8
    
    threexfive = ' 
        #         #      ##     
     ## ### ### ### ###  #  ### 
    # # # # #   # # ##  ### # # 
    ### ### ### ### ###  #   ## 
                        ##  ### 
    '
    
    char_pos = { 
      :a => 0..3,
      :b => 4..7,
      :c => 8..11,
      :d => 12..15,
      :e => 16..19,
      :f => 20..23
    }
    
    word = 'cafe'
    
    result = Array.new(threexfive.lines.count){''}     # array with n empty lines
    word.each_char do |char|
      pos = char_pos[char.to_sym]                      # get position of char
      threexfive.lines.each_with_index do |line,index|
        next if index == 0                             # first line of threexfive is empty -> skip
        result[index] << line[pos]                     # compose individual lines
      end 
    end
    result = result.join("\n")                         # join the lines with \n (newline)
    
    puts result                                        # print result
    

    the output of this program is:

             ##     
    ###  ##  #  ### 
    #   # # ### ##  
    ### ###  #  ### 
            ##      
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need help on regex or preg_match because I am not that experienced yet
I've got 50 to 60 files in a directory that I need to concatenate
I need to make a long string, about 360 characters, with different values that
I have a number of base64 strings that I need to concatenate to send
Need help defining an expression to capture the four numerics per line that define
Need help with PHP Mysql code to insert multiple select data into database. With
need help to create regular expression matching string www.*.abc.*/somestring Here * is wild card
Need help writing a script downloads data from google insight using c# this is
I need help on this following aspx code aspx Code: <asp:Label ID =lblName runat
I need help understanding some C++ operator overload statements. The class is declared like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.