473,396 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Remove Decimal Places

Hi,

Does anyone know how to remove decimal places?
ie: I have 334.43 and I need it to be displayed as 33443.

Sounds simple enough, but I cant seem to find anything that works!

I have tried various ToString(x) formats, but no joy as yet.

Thanks in advance.
H
Nov 18 '05 #1
3 6138
sString.Replace(".","")

-- Andrew
"Harry" <ha************@hotmail.com> wrote in message
news:1c**************************@posting.google.c om...
Hi,

Does anyone know how to remove decimal places?
ie: I have 334.43 and I need it to be displayed as 33443.

Sounds simple enough, but I cant seem to find anything that works!

I have tried various ToString(x) formats, but no joy as yet.

Thanks in advance.
H

Nov 18 '05 #2
float f = 334.43f;
string s = f.ToString().Replace('.', '');

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Harry" <ha************@hotmail.com> wrote in message
news:1c**************************@posting.google.c om...
Hi,

Does anyone know how to remove decimal places?
ie: I have 334.43 and I need it to be displayed as 33443.

Sounds simple enough, but I cant seem to find anything that works!

I have tried various ToString(x) formats, but no joy as yet.

Thanks in advance.
H

Nov 18 '05 #3
Multiply times 100 :)

"Harry" <ha************@hotmail.com> wrote in message
news:1c**************************@posting.google.c om...
Hi,

Does anyone know how to remove decimal places?
ie: I have 334.43 and I need it to be displayed as 33443.

Sounds simple enough, but I cant seem to find anything that works!

I have tried various ToString(x) formats, but no joy as yet.

Thanks in advance.
H

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: John Bentley | last post by:
John Bentley: INTRO The phrase "decimal number" within a programming context is ambiguous. It could refer to the decimal datatype or the related but separate concept of a generic decimal number....
3
by: Brent Bortnick | last post by:
Does anyone know how to find out the number of decimal places a number has. I need this info so that i can round to 3 decimal places if the number has 3 decimal places or to 2 decimal places if...
2
by: Carl G | last post by:
I am storing a 0.000 a System.Decimal in a DataRow. On retrieval the value is only 0 without the three decimal places. It looks like the Get property returns System.Decimal.Zero, but why???? I...
4
by: italia | last post by:
I changed the Fieldsize Property from text to Long Integer and Decimal Places = 6. I had decimals in the original field. But after the transfer, the digits after the decimals are gone. Now...
8
by: nick | last post by:
printf("%lf",3.25); the result is 3.25000 i want the answer correct to 3 decimal places What should i do? thanks!
3
by: mohaaron | last post by:
Hello All, Does anyone know of a way to test a decimal for the number of places it has before and after the decimal? I need to do something like this. decimal value1 = 172.45; // If value1...
2
by: jmarr02s | last post by:
I have a field with a Number data type, Double field size and Auto decimal places. The values of this field should have 3 digits to the right of the decimal place. For example, 123456.123 I...
19
by: VK | last post by:
http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/ b495b4898808fde0> is more than one month old - this may pose problem for posting over some news servers. This is why I'm...
3
by: David | last post by:
Any ideas why this statement: mBalanceChange = Double.Parse(strCurrentBalance, Globalization.NumberStyles.AllowThousands Or Globalization.NumberStyles.AllowDecimalPoint) - mBalanceDouble ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.