Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9176517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:07:31+00:00 2026-06-17T17:07:31+00:00

I am getting data into a text field and I need to display it

  • 0

I am getting data into a text field and I need to display it as a percentage. Is there a function to perform this?

Ex: in my column I have "0.5", "0.1","0.2","0.25" etc., which needs to be displayed as
50%,10%,20%,25% etc., What is the best way to do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T17:07:32+00:00Added an answer on June 17, 2026 at 5:07 pm

    You should do this in two phases:

    • Parse the text as a number so you’ve got the value as your “real” type. (As a general rule, parse from text as early as you can, and format to a string as late as you can… operations between the two will be a lot simpler using the natural type.)
    • Format the number as a percentage using the standard numeric format string for percentage

    So:

    decimal percentage = decimal.Parse(input);
    string output = percentage.ToString("p0");
    

    Notes:

    • You should consider both input and output culture; are you always expecting to use “.” as the decimal separator, for example?
    • Use decimal rather than double to exactly represent the value in the text (for example, the text could have “0.1” but double can’t hold a value of exactly 0.1)
    • You can add things like desired precision to the formatting; see the linked docs for details; the example gives just an integer percentage, for example
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Getting a strange error when trying to insert data into an Access database using
I am inserting some data into an array but I am getting ,9,My firstname,My
I am getting the following exception while adding data into database: org.hibernate.HibernateException: The database
I am trying to pass some data into my Controller, but I'm getting a
I'm getting into using the Repository Pattern for data access with the Entity Framework
Getting error while inserting values into database (SQL Server 2008) Implicit conversion from data
Im getting data from a server by executing this code: - (void) sendGeneral:(NSString *)
I need to build a website where we display data that is refreshed every
I'm trying to create a frontend editor and I'm getting the data into a
So I have been working on getting this Twitter Bootstrap typeahead to work and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.