File extension is in extensions list: Difference between revisions

Line 223:
=={{header|Ruby}}==
<lang ruby>extensions = [".c",".o",""]
["foo.C","foo.zkl","foo","foo."].each{ do |f| p extensions.include?( File.extname(f).downcase )}
puts "%5s : %s" % [extensions.include?( File.extname(f).downcase ), f]
end</lang>
{{out}}
<pre>
true : foo.C
false : foo.zkl
true : foo
true</pre> : foo.
</pre>
 
=={{header|Scala}}==
[[Category:Scala Implementations]]<lang Scala>def isExt(fileName: String, extensions: List[String]): Boolean = {
Anonymous user