32.0 transformed to 000000320000000000
I guess the above would be equivalent to an numeric(18,10) datatype
the first 8 digits represent the whole part of the double
the last 10 represent the decimal part
32.50 transformed to 000000325000000000
I can see building a method (example. DoubleMask(double <adouble>) )
that returns a string after using PadLeft PadRight. Is that a good way? 3 4058
I did it like this, citique please
private string DoubleMask(double adbl)
{
string stradbl;
char achr = '0';
adbl = adbl * 10000000000;
stradbl = Convert.ToInt64(adbl).ToString().PadLeft(18,achr);
return stradbl;
}
"John Sitka" <jo*******@REMOVEhotmail.comwrote in message news:%2****************@TK2MSFTNGP06.phx.gbl...
32.0 transformed to 000000320000000000
I guess the above would be equivalent to an numeric(18,10) datatype
the first 8 digits represent the whole part of the double
the last 10 represent the decimal part
32.50 transformed to 000000325000000000
I can see building a method (example. DoubleMask(double <adouble>) )
that returns a string after using PadLeft PadRight. Is that a good way?
How about :
private string DoubleMask(double adbl)
{
return (adbl * 10000000000).ToString("000000000000000000");
}
"John Sitka" <jo*******@REMOVEhotmail.comwrote in message
news:%2***************@TK2MSFTNGP04.phx.gbl...
>I did it like this, citique please
private string DoubleMask(double adbl)
{
string stradbl;
char achr = '0';
adbl = adbl * 10000000000;
stradbl = Convert.ToInt64(adbl).ToString().PadLeft(18,achr);
return stradbl;
}
"John Sitka" <jo*******@REMOVEhotmail.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>32.0 transformed to 000000320000000000
I guess the above would be equivalent to an numeric(18,10) datatype the first 8 digits represent the whole part of the double the last 10 represent the decimal part
32.50 transformed to 000000325000000000
I can see building a method (example. DoubleMask(double adouble>) ) that returns a string after using PadLeft PadRight. Is that a good way?
Thanks, that's better and works smarter.
"Stephany Young" <noone@localhostwrote in message news:ul**************@TK2MSFTNGP02.phx.gbl...
How about:
private string DoubleMask(double adbl)
{
return (adbl * 10000000000).ToString("000000000000000000");
}
"John Sitka" <jo*******@REMOVEhotmail.comwrote in message news:%2***************@TK2MSFTNGP04.phx.gbl...
>>I did it like this, citique please
private string DoubleMask(double adbl) { string stradbl; char achr = '0'; adbl = adbl * 10000000000; stradbl = Convert.ToInt64(adbl).ToString().PadLeft(18,achr); return stradbl; } "John Sitka" <jo*******@REMOVEhotmail.comwrote in message news:%2****************@TK2MSFTNGP06.phx.gbl...
>>32.0 transformed to 000000320000000000
I guess the above would be equivalent to an numeric(18,10) datatype the first 8 digits represent the whole part of the double the last 10 represent the decimal part
32.50 transformed to 000000325000000000
I can see building a method (example. DoubleMask(double adouble>) ) that returns a string after using PadLeft PadRight. Is that a good way? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Vincent Cantin |
last post by:
I have a class defined by a template which needs to "say" its type to the
user via string.
As an example, here is the class that I want to fix :
template<class T> class Container : public...
|
by: kaede |
last post by:
Hi all,
Given the following data format: { "(1,2), "(2.5, 3.5)", .... }
I would like to define a vector<string> to stored this data:
v = "(1,2)", v = "(2.5, 3.5"), ....
and would like to...
|
by: hana1 |
last post by:
Hello experts,
I used to program in C/C++ and now switched to Java. I am having a
difficulty that I need your help with. How can I limit a double variable to
hold 2 decimal points only? Say I...
|
by: joe_rattz |
last post by:
I need to convert a text string ("Dewey & Cheatham & Howe") to an XML encoded string ("Dewey & Cheatham & Howe"). I am not building an XML document, I am just trying to convert a single string. I...
|
by: Rogers |
last post by:
I want to compare strings of numbers that have a circular boundary
condition. This means that the string is arranged in a loop without an
end-of-string. The comparaison of two strings now...
|
by: Andrew Marlow |
last post by:
Hello,
I am new to java and need to write a program that uses an XML file for its
configuration. I have an equivalent C++ program that uses libxml2 from
gnome for this task. I wrapped this up in...
|
by: curious2007 |
last post by:
I get this long and hard to understand warning when I call a constructor:
AssocArray<double, string> myAssocArray(names, myArr);
the code for the constructor:
template <class V, class AI,...
|
by: Nicolai.Schoenberg |
last post by:
When i try it like you say, he ignores the dot.
For example
s = "12.45";
d = double.Parse(s);
d will be 1245.0 :(
pls help
|
by: huohaodian |
last post by:
Hi,
How can I define a long string variable in C# with multiple lines ?
For example
private string longName = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |