Skip to content

Ankush405/string-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

String Calculator

A Ruby implementation of the String Calculator kata.

Features

  • Add numbers in a string separated by commas or newlines.
  • Supports custom delimiters, including multiple delimiters and delimiters of any length.
  • Throws an exception for negative numbers.
  • Ignores numbers greater than 1000.

Usage

StringCalculator.add("1,2,3") # => 6
StringCalculator.add("1\n2,3") # => 6
StringCalculator.add("//;\n1;2") # => 3
StringCalculator.add("//[*][%]\n1*2%3") # => 6
StringCalculator.add("//[***][%%]\n1***2%%3") # => 6

Running Tests

bundle install
rspec

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages