Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Trim trailing 0 from decimal place of number

Reply
Thread Tools

Trim trailing 0 from decimal place of number

 
 
martin
Guest
Posts: n/a
 
      07-19-2004
Hi,

I am having difficulty trimming any traling 0's from my decimal numbers.
I store then in the database to 2 decimal places.
This means that when they come back to my application they still diply with
all the decimal places

eg

10.00 displays as 10.00
10.10 displays as 10.10

what I would like to achieve is the following

10.00 displays as 10
10.10 displays as 10.1

many thanks in advance

cheers

martin.


 
Reply With Quote
 
 
 
 
Rick Strahl [MVP]
Guest
Posts: n/a
 
      07-19-2004
string.Format("{0}",10);
string.Format("{0}",10.10);

should do the trick. Actually the above behavior should be the default
behavior...

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
----------------------------------
Making waves on the Web


"martin" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I am having difficulty trimming any traling 0's from my decimal numbers.
> I store then in the database to 2 decimal places.
> This means that when they come back to my application they still diply

with
> all the decimal places
>
> eg
>
> 10.00 displays as 10.00
> 10.10 displays as 10.10
>
> what I would like to achieve is the following
>
> 10.00 displays as 10
> 10.10 displays as 10.1
>
> many thanks in advance
>
> cheers
>
> martin.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How to trim a String trailing spaces, but not leading spaces? Roedy Green Java 3 09-14-2008 02:10 AM
Re: How to trim a String trailing spaces, but not leading spaces? John B. Matthews Java 4 09-12-2008 05:28 AM
trim start and trailing space chars from string Konstantinos Pachopoulos Python 1 09-15-2007 10:33 AM
FAQ Topic - How do I trim whitespace - LTRIM/RTRIM/TRIM? FAQ server Javascript 0 10-25-2006 11:00 PM
FAQ Topic - How do I trim whitespace - LTRIM/RTRIM/TRIM? FAQ server Javascript 0 08-28-2006 11:00 PM



Advertisments