6 kyu

Time-like string format

167 of 1,239vshjxyz

Description:

Build up a method that takes an integer and formats it to a 'time - like' format.

The method must raise an exception if its hour length is less than 3 digits and greater than 4.

Example:

solution(800) # should return '8:00'
solution(1000) # should return '10:00'
solution(1451) # should return '14:51'
solution(3351) # should return '33:51'
solution(10000) # should raise an exception
solution(800); // should return '8:00'
solution(1000); // should return '10:00'
solution(1451); // should return '14:51'
solution(3351); // should return '33:51'
solution(10000); // should raise an exception
Kata.Solution(800); // should return '8:00'
Kata.Solution(1000); // should return '10:00'
Kata.Solution(1451); // should return '14:51'
Kata.Solution(3351); // should return '33:51'
Kata.Solution(10000); // should raise an exception
Strings
Fundamentals

More By Author:

Check out these other kata created by vshjxyz

Stats:

CreatedJul 12, 2013
PublishedJul 16, 2013
Warriors Trained1791
Total Skips153
Total Code Submissions8401
Total Times Completed1239
CoffeeScript Completions167
JavaScript Completions912
C# Completions170
Total Stars20
% of votes with a positive feedback rating85% of 262
Total "Very Satisfied" Votes191
Total "Somewhat Satisfied" Votes61
Total "Not Satisfied" Votes10
Ad
Contributors
  • vshjxyz Avatar
  • jhoffner Avatar
  • antyblin Avatar
  • aweleshetu Avatar
  • JohanWiltink Avatar
  • Souzooka Avatar
  • hobovsky Avatar
Ad