删除文件扩展名的最佳方法 [英] best way to remove file extension
本文介绍了删除文件扩展名的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
删除文件扩展名的最短方法是什么?这是我尝试过的:
What is the shortest way to remove file extension? this is what I have tried:
file = "/home/usr/my_file.xml"
file = File.basename(file)
file.slice! File.extname(file) #=> my_file
推荐答案
查看全文