F
francisrammeloo
Hi all,
My goal is to obtain the filename out of a full pathname.
This is the code:
fullname = "./Dir/file.txt"
array = fullname.split( /.*\// ) # Searches greedyly until the last
slash
The results are:
puts array.length ==> 2
puts array[0] ==> (newline symbol or something??)
puts array[1] ==> file.txt
My questions are:
Why has the array a length of 2?
What is in array[0]?
Best regards,
Francis
My goal is to obtain the filename out of a full pathname.
This is the code:
fullname = "./Dir/file.txt"
array = fullname.split( /.*\// ) # Searches greedyly until the last
slash
The results are:
puts array.length ==> 2
puts array[0] ==> (newline symbol or something??)
puts array[1] ==> file.txt
My questions are:
Why has the array a length of 2?
What is in array[0]?
Best regards,
Francis