s = 'example 2 .png'puts File.basename(s,File.extname(s)).rstrip.gsub(" ", "_") + File.extname(s)
Standard input is empty
example_2.png
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!