File.extname(path) รข string
Class Public methods
Returns the extension (the portion of file name in path
starting from the last period).
If path
is a dotfile, or starts with a period, then the
starting dot is not dealt with the start of the extension.
An empty string will also be returned when the period is the last character
in path
.
File.extname("test.rb") #=> ".rb" File.extname("a/b/d/test.rb") #=> ".rb" File.extname("foo.") #=> "" File.extname("test") #=> "" File.extname(".profile") #=> "" File.extname(".profile.sh") #=> ".sh"
Please login to continue.