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