TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sompal Arya
NA
286
50.3k
how to convert 69,95,384 into 6995384
Mar 7 2014 11:46 AM
i have a method for convert 6995384 into 69,95,384 .
public static string CurrencyMethod(string val,bool IsDecimal=false)
{
var x = val;
if (decimal.Parse(val) == 0 && IsDecimal)
{
return "0.0";
}
if (decimal.Parse(val) == 0)
{
return "0";
}
string sAfterPoint = x.Contains('.') ? '.' + x.Split('.')[1] : "";
string sBeforePoint = x.Contains('.') ? x.Split('.')[0] : x;
int sBeforePointLength = sBeforePoint.Length;
string sBeforePointLastThree = "";
string sBeforePointExceptLastThree = "";
var allchar = "";
if (sBeforePointLength > 3)
{
sBeforePointLastThree = sBeforePoint.Substring(sBeforePointLength - 3);
sBeforePointExceptLastThree = sBeforePoint.Substring(0, sBeforePointLength - 3);
if (sBeforePointExceptLastThree.Length % 2 == 0)
{
if (sBeforePointExceptLastThree.Length > 0)
{
for (int i = 0; i < sBeforePointExceptLastThree.Length; i = (i + 2))
{
var f = sBeforePointExceptLastThree.Substring(i, 2);
allchar += f + ",";
}
}
}
else
{
allchar = sBeforePointExceptLastThree.Substring(0, 1) + ",";
var restallchar = sBeforePointExceptLastThree.Substring(1, sBeforePointExceptLastThree.Length - 1);
if (restallchar.Length > 0)
{
for (int i = 0; i < restallchar.Length; i = (i + 2))
{
var f = restallchar.Substring(i, 2);
allchar += f + ",";
}
}
}
}
else
{
sBeforePointLastThree = sBeforePoint;
}
return allchar + sBeforePointLastThree + sAfterPoint;
}
But i want to do vice versa 69,95,384 into 6995384 .help me...
Reply
Answers (
3
)
linking databases
Read data from office 2007 Word With C#