Anonymous user
File extension is in extensions list: Difference between revisions
File extension is in extensions list (view source)
Revision as of 00:20, 13 August 2014
, 9 years ago→{{header|Perl 6}}: handle extensions the Unix Way, agnostically
Walterpachl (talk | contribs) m (→{{header|REXX}}: typos) |
(→{{header|Perl 6}}: handle extensions the Unix Way, agnostically) |
||
Line 83:
a/b/c\d/foo: true</pre>
=={{header|Perl 6}}==
<lang perl6>
for @files {
}
}
ext-in-list
«
▲ when / :i @ext $ / { say "$_\t$/ is in the list" }
.c
▲ when / '.' <-[/.]>* $ / { say "$_\t$/ is not in the list" }
.C#
▲ default { say "$_\t (has no extension)" }
.o
}</lang>▼
.yup
.½xy
'. embedded blanks '
»,
«
foo.c
foo.C
foo.C++
foo.c#
foo.zkl
somefile
'holy smoke'
afile.
/a/path/to/glory.yup/or_not
funny...
unusual.½xy
'fly_in_the_ointment. embedded blanks '
{{out}}
<pre>True foo.
True foo.C
False foo.C++
True foo.c#
False foo.zkl
---- somefile
---- holy smoke
---- afile.
---- /a/path/to/glory.yup/or_not
---- funny...
True unusual.½xy
True fly_in_the_ointment. embedded blanks
</pre>
=={{header|Python}}==
|