Solved

Trimming a number to 2 decimal places + remove trailing zeros

Posted on 2006-11-10
2
947 Views
Last Modified: 2007-12-19
I'd like to display a numer in the format XXX.XX, but also trim off any trailing zeros that exist in the remaining 2 decimal places.

Can anyone tell me the best way to display this number?  I'm going to use the code in a function, that will accept a double value as the input.

i.e.
33.333333  --->  33.33
25.50         --->  25.5
50             --->   50
0
Comment
Question by:Rouchie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 500 total points
ID: 17913648
Hi Rouchie,

MyNumberString = MyNumericValue.ToString("#.##")

Tim Cottee
0
 
LVL 25

Author Comment

by:Rouchie
ID: 17913877
I knew it would be really simple but couldn't find any information online to help me solve it!

Thanks Tim.
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
asp Google Map 2 93
CSS for Popup in ASP.NET 4 49
Disable the weekends on datepicker control 6 52
same domain, but different cookies. why? 6 11
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question