How to resolve the algorithm File extension is in extensions list step by step in the Phix programming language
How to resolve the algorithm File extension is in extensions list step by step in the Phix programming language
Table of Contents
Problem Statement
Filename extensions are a rudimentary but commonly used way of identifying files types.
Given an arbitrary filename and a list of extensions, tell whether the filename has one of those extensions.
Notes:
The following test cases all assume this list of extensions: zip, rar, 7z, gz, archive, A## If your solution does the extra credit requirement, add tar.bz2 to the list of extensions, and check the following additional test cases: Checking if a file is in a certain category of file formats with known extensions (e.g. archive files, or image files) is a common problem in practice, and may be approached differently from extracting and outputting an arbitrary extension (see e.g. FileNameExtensionFilter in Java). It also requires less assumptions about the format of an extension, because the calling code can decide what extensions are valid. For these reasons, this task exists in addition to the Extract file extension task.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm File extension is in extensions list step by step in the Phix programming language
Source code in the phix programming language
You may also check:How to resolve the algorithm Main step of GOST 28147-89 step by step in the X86 Assembly programming language
You may also check:How to resolve the algorithm Arithmetic/Integer step by step in the Pop11 programming language
You may also check:How to resolve the algorithm First class environments step by step in the Java programming language
You may also check:How to resolve the algorithm Singly-linked list/Element definition step by step in the Clean programming language
You may also check:How to resolve the algorithm World Cup group stage step by step in the Julia programming language