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 reThe 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:
Fundamentals
Strings
Restricted
Similar Kata:
Stats:
Created | Dec 5, 2016 |
Published | Dec 5, 2016 |
Warriors Trained | 2920 |
Total Skips | 462 |
Total Code Submissions | 5546 |
Total Times Completed | 1735 |
Python Completions | 808 |
Ruby Completions | 126 |
C# Completions | 193 |
TypeScript Completions | 112 |
JavaScript Completions | 420 |
PHP Completions | 154 |
Total Stars | 44 |
% of votes with a positive feedback rating | 90% of 338 |
Total "Very Satisfied" Votes | 280 |
Total "Somewhat Satisfied" Votes | 50 |
Total "Not Satisfied" Votes | 8 |
Total Rank Assessments | 8 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |