========
ABOUT
========

NumberToString is a simple project originally designed to convert currency to its string description in a language you
provide an implementation for, however it can used to convert for many purposes to because I didn't include any currency
names into it.

You can think of this project as driver to convert numbers to string then you add or manipulate them.

===========
LANGUAGES
===========

Till now only Arabic is implemented.

==========
DESGIN
==========

In code you have one namespace NumberToString which contain 2 classes:

   1- FormatInfo: which will have the result of the conversion, it have the following prototype:

        public class FormatInfo
        {
            public ulong Integer;
            public string IntegerString;
            public ulong Fraction;
            public string FractionString;
            public string NumberFormatted;
        }

    refer to file 'FormatInfo.cs' for documentation.

    2- FormatNumber: is the manager class that initiate instance for each language, it have the following prototype:

        public abstract class FormatNumber
        {
            private static NumberFormatInfo defaultNumberFormat = new CultureInfo(0x409).NumberFormat;

            public static NumberFormatInfo DefaultNumberFormat
            { get { return defaultNumberFormat; } }

            public FormatInfo ToString(ulong intPart)
            { return ToString(intPart, 0, defaultNumberFormat); }

            public FormatInfo ToString(ulong intPart, NumberFormatInfo format)
            { return ToString(intPart, 0, format); }

            public FormatInfo ToString(ulong intPart, ulong fractionPart)
            { return ToString(intPart, fractionPart, defaultNumberFormat); }

            public abstract FormatInfo ToString(ulong intPart, ulong fractionPart, NumberFormatInfo format);
        }

    refer to file 'FormatNumber.cs' for documentation.

==================
IMPLEMENTATION
==================

there a default implementation for Arabic language in 2 files:

    1- FormatNumberToArabic: contains implementation for ToString to convert number its Arabic description.
       refer to 'ArabicFormat.cs' for implementation and 'ArabicStrings.cs' for string resources used in FormatNumberToArabic.
       the implementation can represent all ranges of numbers supported by 64bit unsigned integer.

       you can not initiate the class you self you will need to use the Arabic static property in class FormatNumber to access the implementation.

========
HOW TO
========

the class FormatNumber will have a static property for each language, for example you can convert 33669.112 to Arabic as following:

using NumberToString;

class Program
{
    public static void Main()
    {
        FormatInfo fi = FormatNumber.Arabic.ToString(33669, 112);
		// fi.IntegerString and fi.FractionString will have Arabic the proper description.
    }
}

=============
SOURCE CODE
=============

for updates and fixes visit https://github.com/muhammad1985/numstr
