C# Класс Evbpc.Framework.Utilities.LanguageHelpers

This class provides helper methods to assist in language-specific situations. (Number conversions from Roman to Decimal, etc.)
Показать файл Открыть проект

Открытые методы

Метод Описание
NumberToRoman ( int number, bool allowShorthand = true ) : string

Converts an integer to it's roman number equivalent. When used after a conversion of RomanToNumber(string, bool, bool) this method should return the original roman that was presented.

RomanToNumber ( string roman, bool allowShorthand = true, bool throwExceptions = true ) : int

Converts a roman number string to it's integer equivalent. When used after a conversion of NumberToRoman(int, bool) this method should return the original number that was presented.

Описание методов

NumberToRoman() публичный статический Метод

Converts an integer to it's roman number equivalent. When used after a conversion of RomanToNumber(string, bool, bool) this method should return the original roman that was presented.
public static NumberToRoman ( int number, bool allowShorthand = true ) : string
number int The integer to convert.
allowShorthand bool Optional: use shorthand/subtraction rules. Certain sequences of small value characters preceeding large value characters are allowed.
Результат string

RomanToNumber() публичный статический Метод

Converts a roman number string to it's integer equivalent. When used after a conversion of NumberToRoman(int, bool) this method should return the original number that was presented.
public static RomanToNumber ( string roman, bool allowShorthand = true, bool throwExceptions = true ) : int
roman string The roman number to convert to an integer.
allowShorthand bool Optional: if true use shorthand/subtraction rules, certain sequences of small value characters preceeding large value characters are allowed. If false throws an exception (if specified) when a shorthand situation is encountered.
throwExceptions bool Optional: if true throws exceptions as normal. If false does not throw exceptions and instead returns -1 immediately when an exception would be thrown. (Note: Setting false here is faster than wrapping the call in a Try-Catch block.)
Результат int