I have two questions regarding Ruby.
For the below code#1, I am trying to print all the file names inside a folder, but "puts text" will gave me "/folder1/folder2/filename1.txt" for example. How can I just print just "filename1" without the directory and the .txt
number1:
Dir.glob('/folder1/folder2/*.txt').each do |text|
puts text
number2: i am trying to combine two array
a = [16,5,6,8,7]
b = [people,men,guys,boys,you]
the output will look like:
people:16, men:5, guys:6, boys:8, you:7
i converted a to string by using .to_s but i still can't combine them.
Aucun commentaire:
Enregistrer un commentaire