Git Product home page Git Product logo

romannumeral's Introduction

RomanNumeral

This is a C# .NET data type representation of the numeric system used in ancient Rome, employing combinations of letters from the Latin alphabet. Permissible values fall within the range of 1 - 3,999.

This package is available as a Nuget package on nuget.org.

I, II, III, IV, V, VI, VII, VIII, IX, X ...

Getting Started

Creation

Several convenience constructors give you the ability to create a roman numeral data type using either a numeric value or a roman numeral string. Once a RomanNumeral object is created, its value is static for the duration of its lifetime.

var numberOne = new RomanNumeral(411);		// CDXI
var numberTwo = new RomanNumeral("MCMXC");	// 1990
Console.WriteLine(new RomanNumeral(31));	// XXXI

Conversion

Convert a roman numeral string to a numeric value.

int value;
if (RomanNumeral.TryParse(romanNumeral, out value))
{
	// Do something with the converted value.
}

Math

You can treat a RomanNumeral type just like you would treat any other numeric type to perform math operations.

var numberOne = new RomanNumeral(10);
var numberTwo = new RomanNumeral(5);

Console.WriteLine(numberOne * numberTwo);		// L
Console.WriteLine(numberOne / numberTwo);		// II
Console.WriteLine(numberOne + numberTwo);		// XV
Console.WriteLine(numberOne - numberTwo);		// V

romannumeral's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.