13,097,230 members (58,893 online)
alternative version

#### Stats

29.3K views
12 bookmarked
Posted 10 Sep 2010

# Convert Numeric Currency into Words for International Currency - Part - II (Optimized)

, 12 Sep 2010
 Rate this:
Converts numeric currency in words with two modes - international and Indian. e.g., 1000000 to ten Lacs (for India) one million (for international)

## Introduction

So after a long (almost 13 days) time, I am going to take my article to the next level.

Have a look at my previous article:

First walk through the base article. In this article, you will find extension only to that article.

## Background

Let's have a look at the snapshots.

#### For Indian

For International

## Using the Code

So let me start by depicting the extension points to the previous article.

First, I have added one enumeration, which is about to be passed at the constructor of the class and will be set to global variable for program to know in which type to convert.

```public enum Criteria
{
Indian,
Foreign
}```

Another change is in which pattern data is to be filled to hashtable.

E.g.

In Indian currency, you can split `234445443345345` into `23,44,45,44,33,45,345 `( I mean first group of three digit and then 2 digits).

In foreign currency, you can split `234445443345345` into `234,445,443,345,345 `(I mean groups of three digits).

So as per that, I will also need to change the way data is filling to hashtable.

Take a look:

```private void InsertToPunctuationTable(string strValue)
{
int j = 0;
if (Native == Criteria.Indian)
{
j = 2;
for (int i = 3; i < strValue.Length; i = i + 2)
{
if (strValue.Substring(i).Length > 0)
{
if (strValue.Substring(i).Length >= 2)
else
}
else
break;
j++;
}
}
if (Native == Criteria.Foreign)
{
for (int i = 0; i < strValue.Length; i = i + 3)
{
if (strValue.Substring(i).Length > 0)
{
if (strValue.Substring(i).Length >= 3)
else
}
j++;
}
}
}```

For Indian currency, I have depicted hashtable picture in the previous article. Now take a look at the hashtable data on foreign condition:

Same way differentiate Notation.

```private void LoadStaticPrefix()
{
if (Native == Criteria.Indian)
{
}
if (Native == Criteria.Foreign)
{
}
}```

These all are extensions to the previous article, rest is the same as previous.

## Points of Interest

This is Part-II, if anybody wants it in another notation as well, give me the notation, will I publish it as part-III.

## History

• 10th September, 2010: Initial post

## Share

 Software Developer India
He is a Smart IT devloper with Few years of Expeariance But having Great command on ASP.net,C#,SQL Query,SSRS,Crystal Reports

Apart from that He Loves multimedia work too, Master of Adobe photoshop, Illustrator, CSS , HTML and all things.

He is Currently working in Microsoft Dynamics CRM and Having Nice Expearince with CRM. CRM Rocks!!!

## You may also be interested in...

 First Prev Next
 international currency.in word Member 109683668-Aug-14 0:35 Member 10968366 8-Aug-14 0:35
 My vote of 5 thatraja19-Sep-10 20:10 thatraja 19-Sep-10 20:10
 Re: My vote of 5 Hiren Solanki19-Sep-10 20:17 Hiren Solanki 19-Sep-10 20:17
 My vote of 2 karabax10-Sep-10 5:52 karabax 10-Sep-10 5:52
 Re: My vote of 2 [modified] Hiren Solanki10-Sep-10 17:01 Hiren Solanki 10-Sep-10 17:01
 gr8 Jinal Desai - LIVE10-Sep-10 5:39 Jinal Desai - LIVE 10-Sep-10 5:39
 Re: gr8 Hiren Solanki10-Sep-10 21:03 Hiren Solanki 10-Sep-10 21:03
 Super KunalChowdhury10-Sep-10 5:04 KunalChowdhury 10-Sep-10 5:04
 Re: Super Hiren Solanki10-Sep-10 21:03 Hiren Solanki 10-Sep-10 21:03
 Re: Super KunalChowdhury10-Sep-10 21:07 KunalChowdhury 10-Sep-10 21:07
 Re: Super Hiren Solanki10-Sep-10 21:08 Hiren Solanki 10-Sep-10 21:08
 Re: Super KunalChowdhury10-Sep-10 21:16 KunalChowdhury 10-Sep-10 21:16
 Last Visit: 31-Dec-99 18:00     Last Update: 23-Aug-17 22:08 Refresh 1