C# percent without zeros

Posted on 2008-11-13
Last Modified: 2012-05-05
c# .net
lblRateTitle.Text = RateTitle.ToString("p1");

I'm displaying a percent sign, but it reads....0.45%. and  0.4% and 3.0%
Is there any way to make it read .45% and .4%  and 3% without the zero?
Question by:designaire
    LVL 14

    Accepted Solution

    LVL 4

    Expert Comment

    try the following format:
    lblRateTitle.Text = RateTitle.ToString("#.0#%")

    Hope it works.


    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
    Article by: Najam
    Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    728 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now