Get The Base Name of an Elixir Template File I've got the following Elixir code:

defmodule T do
    @eex_extension "eex"
    @file_separator "."
    def get_base_file_name_from_template_name(template_file_name) do
        [base, extension, @eex_extension] = String.split(template_file_name,@file_separator)
        base &lt;&gt; @file_separator &lt;&gt; extension
    end
end  


It works like this:

iex(3)&gt; f = T.get_base_file_name_from_template_name("index.html.eex")
"index.html"


1.) Is there a built-in library function I'm missing that would do this?

2.) Is there a built-in attribute for the eex file extension?

3.) Is there an OS built-in value for the "." BTW, I think file separator is not a great name for that but I can't come up with a better name. 

Thoughts, comments, suggestions would be greatly appreciated. Even better yet if this is a built-in function in one of the Elixir libs and I've missed it a pointer to it would be most welcome.
Since you seem to know what the file extension is, you can use Path.basename/2. 

"foo.html.eex"
  |&gt; Path.basename(".eex")
  |&gt; IO.puts


If you don’t know the file extension, you can use Path.extname/1 in conjunction. 

filename = "foo.html.eex"
filename
  |&gt; Path.basename(Path.extname(filename))
  |&gt; IO.puts