C# Class Evbpc.Framework.Utilities.LanguageHelpers

This class provides helper methods to assist in language-specific situations. (Number conversions from Roman to Decimal, etc.)
Afficher le fichier Open project: EBrown8534/Framework

Méthodes publiques

Méthode Description
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.

Method Details

NumberToRoman() public static méthode

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.
Résultat string

RomanToNumber() public static méthode

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.)
Résultat int