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 <> @file_separator <> extension
end
end
It works like this:
iex(3)> 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.