6 kyu

File Path Operations

808 of 1,735user2514386

Description:

Task:
This kata requires you to write an object that receives a file path and does operations on it. NOTE FOR PYTHON USERS: You cannot use modules os.path, glob, and re
The purpose of this kata is to use string parsing, so you're not supposed to import external libraries. I could only enforce this in python.
Testing:

Python:

>>> master = FileMaster('/Users/person1/Pictures/house.png')
>>> master.extension()
'png'
>>> master.filename()
'house'
>>> master.dirpath()
'/Users/person1/Pictures/'

Ruby:

master = FileMaster.new('/Users/person1/Pictures/house.png')
master.extension
#--> png
master.filename
#--> house
master.dirpath
#--> /Users/person1/Pictures/

C#:

FileMaster FM = new FileMaster("/Users/person1/Pictures/house.png");
FM.extension(); // output: "png"
FM.filename(); // output: "house"
FM.dirpath(); // output: "/Users/person1/Pictures/"

JavaScript:

const fm = new FileMaster('/Users/person1/Pictures/house.png');
fm.extension(); // output: 'png'
fm.filename(); // output: 'house'
fm.dirpath(); // output: '/Users/person1/Pictures/'

TypeScript:

const fm = new FileMaster('/Users/person1/Pictures/house.png');
fm.extension(); // output: 'png'
fm.filename(); // output: 'house'
fm.dirpath(); // output: '/Users/person1/Pictures/'

PHP:

$fm = new FileMaster('/Users/person1/Pictures/house.png');
$fm.extension(); // 'png'
$fm.filename(); // 'house'
$fm.dirpath(); // '/Users/person1/Pictures'
Notes:
  • I have other kata that need to be tested. You may find them here and here
  • Please post any questions or suggestion in the discourse section. Thank you!
  • Thank to all users who contributed to this kata! I appreciate your input!
Fundamentals
Strings
Restricted

Stats:

CreatedDec 5, 2016
PublishedDec 5, 2016
Warriors Trained2920
Total Skips462
Total Code Submissions5546
Total Times Completed1735
Python Completions808
Ruby Completions126
C# Completions193
TypeScript Completions112
JavaScript Completions420
PHP Completions154
Total Stars44
% of votes with a positive feedback rating90% of 338
Total "Very Satisfied" Votes280
Total "Somewhat Satisfied" Votes50
Total "Not Satisfied" Votes8
Total Rank Assessments8
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • user2514386 Avatar
  • suic Avatar
  • brunolm Avatar
  • smolen Avatar
  • narayanswa30663 Avatar
  • Mazur213 Avatar
  • Blind4Basics Avatar
  • hobovsky Avatar
  • Just4FunCoder Avatar
Ad